title: Postgres insert record with Sequence generates error - org.postgresql.util.PSQLException: ERROR: relation "dual" does not exist
body: <p>I am new to Postgres database.</p>
  
  <p>I have a Java Entity class with the below column for ID:</p>
  
  <pre><code>@Entity
  @Table(name = "THE_RULES")
  public class TheRulesEntity {
  /** The id. */
      @Column(name = "TEST_NO", precision = 8)
      @SequenceGenerator(name = "test_no_seq", sequenceName = "TEST_NO_SEQ")
      @GeneratedValue(generator = "test_no_seq", strategy = GenerationType.AUTO)
      @Id
      private Long id;
  
  /** The test val. */
      @Column(name = "TEST_VAL", nullable = false, length = 3)
      private String testVal;
  </code></pre>
  
  <p>Code:</p>
  
  <pre><code>rulesRepository.saveAndFlush(theRulesEntity)
  </code></pre>
  
  <p>Table:</p>
  
  <pre><code>CREATE TABLE THE_RULES
  (
      TEST_NO         INT NOT NULL,
      TEST_VAL        VARCHAR(3) NOT NULL
  )
  
  CREATE SEQUENCE "TEST_NO_SEQ" START WITH 1000 INCREMENT BY 1;
  </code></pre>
  
  <p>When I try to insert a new record into the postgres database from my application (the ID value is null in Java code during Debug mode), then I get the below error:</p>
  
  <pre><code>Caused by: org.postgresql.util.PSQLException: ERROR: relation "dual" does not exist
  </code></pre>
  
  <p>But If I insert the record manually into database table and then update the record from my application, then the record is updated successfully (Probably because the application uses the same ID value so no need to refer to the Sequence TEST_NO_SEQ value anymore)</p>
  
  <p>Looks like the database is not able to access the sequence from dual table.
  Could anyone help me how to fix this?</p>
  
  <p>Thanks.</p>