Unable to insert values in a table using sequence in Liquibase

somename

I want to use sequence_name.NEXTVAL to automatically compute a column's value in liquibase. The backend database is postgresql. I tried to use "valueComputed" attribute as shown in this link. But it is not computing value using sequence and column's value is null at the time of insertion. How can we auto increment a column in liquibase using a sequence? Thank you for your help in advance.

My code is as below :

    <changeSet id="20151020000" author="jhipster">      

    <createSequence cycle="false" incrementBy="1" maxValue="1000"  minValue="50" sequenceName="seq_name" startValue="50"/>

    <createTable tableName="tablename">
                <column name="id" type="bigint" valueComputed ="seq_name.NEXTVAL">
                    <constraints primaryKey="true" nullable="false"/>
                </column>
   </createTable>
dfche

This worked for me:

<createTable tableName="tablename">
    <column name="id" type="bigint" defaultValueSequenceNext="seq_name">
        <constraints primaryKey="true" nullable="false"/>
    </column>
</createTable>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to insert using a sequence with Liquibase

From Dev

mySQL - Unable to Insert Values to Table

From Dev

Unable to Insert into table using EXEC

From Dev

insert values into table using Varray

From Dev

unable to insert into sqlite_sequence table in sqlite3 swift

From Dev

Not able to insert values in history table which has (SEQUENCE_NO) as Column

From Dev

Unable to insert values into database using ajax call

From Dev

Unable to insert into table using PDO in mysql

From Dev

Unable to insert data in a MySQL table using PHP

From Java

Insert form values in a table using javascript

From Dev

How to insert checkbox values into table using PHP?

From Dev

Query for Insert into using values from other table

From Dev

Insert values into MySQL table using PHP

From Dev

insert values into table using concatenation and Varray

From Dev

How to insert checkbox values into table using PHP?

From Dev

Using Dapper to Insert into a Table with Default Values

From Dev

Insert values into a table with a foreign key using mysql

From Dev

get index from postgresql sequence using liquibase

From Dev

Insert sequence of values for the same entity

From Dev

insert table values into textbox

From Dev

Insert values in junction table

From Dev

insert table values into textbox

From Dev

mysql insert values into table?

From Dev

Insert in a table 2 values

From Dev

Insert into table many values

From Dev

How to insert values in table

From Dev

SQL insert multiple rows into a table using a variable with multiple values as one of the values to insert

From Dev

Insert in SQL table using select with column values from another select

From Dev

Insert values into a table from multiple tables using sqlite query

Related Related

  1. 1

    How to insert using a sequence with Liquibase

  2. 2

    mySQL - Unable to Insert Values to Table

  3. 3

    Unable to Insert into table using EXEC

  4. 4

    insert values into table using Varray

  5. 5

    unable to insert into sqlite_sequence table in sqlite3 swift

  6. 6

    Not able to insert values in history table which has (SEQUENCE_NO) as Column

  7. 7

    Unable to insert values into database using ajax call

  8. 8

    Unable to insert into table using PDO in mysql

  9. 9

    Unable to insert data in a MySQL table using PHP

  10. 10

    Insert form values in a table using javascript

  11. 11

    How to insert checkbox values into table using PHP?

  12. 12

    Query for Insert into using values from other table

  13. 13

    Insert values into MySQL table using PHP

  14. 14

    insert values into table using concatenation and Varray

  15. 15

    How to insert checkbox values into table using PHP?

  16. 16

    Using Dapper to Insert into a Table with Default Values

  17. 17

    Insert values into a table with a foreign key using mysql

  18. 18

    get index from postgresql sequence using liquibase

  19. 19

    Insert sequence of values for the same entity

  20. 20

    insert table values into textbox

  21. 21

    Insert values in junction table

  22. 22

    insert table values into textbox

  23. 23

    mysql insert values into table?

  24. 24

    Insert in a table 2 values

  25. 25

    Insert into table many values

  26. 26

    How to insert values in table

  27. 27

    SQL insert multiple rows into a table using a variable with multiple values as one of the values to insert

  28. 28

    Insert in SQL table using select with column values from another select

  29. 29

    Insert values into a table from multiple tables using sqlite query

HotTag

Archive