I have a PostgreSQL schema defined using liquibase. I have used ‘SERIAL’ datatype. For these datatypes, the database creates a sequence in it’s pg_catalog table with some specific name. Now I am porting my application to support Oracle. I added a separate change-set for creating a sequence. The sequence name created by PostgreSQL is very large and Oracle does not allow it. I need to modify my schema definition such that both would have same sequence name. This is because I am using hibernate and need to specify the same in the respective hbm files.
The alternative that I can think of is to have a different change set for PostgreSQL and Oracle. For PostgreSQL, it would have create table tag that would generate query something like mentioned here [http://www.postgresql.org/docs/8.1/static/datatype.html#DATATYPE-SERIAL]. And then another change-set for Oracle to just create the table and associated sequence.
I am interested in knowing if this is the right and only approach to achieve this.
In PostgreSQL you can create the sequence with any name. The data type
serialis just shorthand for – I quote the manual here:So use shorter names for your sequences. Or use shorter table names and save yourself the hassle.