Generatedchangelog not generating all sequences

Hello,

I am trying to generatechangelog all my sequences but i am not possible to do it.

I have created a postgres database via SQL files and i am trying to export that DB to XML.

I have created 1 sequence in SQL via

“create sequence test if not exists”

and there are other 9 sequences which has been auto created by the creation of table by having Serial datatype for ID’s.

So when i am trying to export all those 10 sequences I m able to have only the one which has been created by the “create sequence” command and nothing else.

Is there any way to get all those 10 sequences to XML?

Hi @michey Thanks you for joining the community. Liquibase should be able to retrieve the sequences. I will test to see what is different in your environment. Do you have the scripts that were used to create your tables? Of course, abstracting any proprietary or customer data.

Hello Mike,
I am attaching my XML below. When i run a liquibase command to generate sequences, it does not create any XML for that sequences of ID’s.

liquibase --changeLogFile=2_inserts.sql --url=“jdbc:postgresql://localhost:5432/postgres” --username=postgres --password=postgres --driver=org.postgresql.Driver --defaultSchemaName=public --diffTypes=data generateChangeLogliquibase --changeLogFile=sec.xml --url=“jdbc:postgresql://localhost:5432/referencedata_db” --username=postgres --password=postgres --driver=org.postgresql.Driver --liquibaseSchemaName=referencedata_db --diffTypes=sequences generateChangeLog

<changeSet author="mike" id="1642677628909-1">
    <createTable tableName="list">
        <column autoIncrement="true" name="id" type="BIGINT">
            <constraints nullable="false" primaryKey="true" primaryKeyName="list_pkey"/>
        </column>
        <column name="key" type="VARCHAR(255)">
            <constraints nullable="false"/>
        </column>
        <column name="type" type="VARCHAR(30)"/>
        <column name="ui_editable" type="BOOLEAN"/>
    </createTable>
</changeSet>
<changeSet author="mike" id="1642677628909-2">
    <createTable tableName="list_item">
        <column autoIncrement="true" name="id" type="BIGINT">
            <constraints nullable="false" primaryKey="true" primaryKeyName="list_item"/>
        </column>
        <column name="cd" type="VARCHAR(255)">
            <constraints nullable="false"/>
        </column>
        <column name="edit" type="BOOLEAN"/>
        <column name="valid_from" type="TIMESTAMP WITHOUT TIME ZONE">
            <constraints nullable="false"/>
        </column>
        <column name="valid_to" type="TIMESTAMP WITHOUT TIME ZONE"/>
        <column name="list_id" type="BIGINT"/>
    </createTable>
</changeSet>

@michey I am curious if this also reproduces if you create the table and id column without autoIncrement=“true” property set inline but introduce a new, standalone changeset, after the createTable. This changeset is of type: addAutoIncrement | Liquibase Docs

Then of course, re-run the generateChangeLog…

Hi @MikeOlivas, Did you get the chance to look into it. Actually I am facing the same issue with Liquibase 4.25.1 and Postgres 14.4

Hi @jitender I did not get to see it because I didn’t get the scripts that we used to create the table with the 10 sequences to see what is special or different about that table.
Do you have the scripts used to create the table minus any proprietary info or a sample DDL that creates the table in order to pull out the info with a generateChangeLog to recreate the issue?