Toad World® Forums

Generated SQL for Postgresql 9.5 BigSerial


#1

Modeller v6.3 generated SQL for PostgreSQL v9.5 type BigSerial columns is creating a default, pointing to a sequence. This isn’t valid syntax as BigSerials imply the default and providing both causes error:

ERROR: multiple default values specified for column “id_pk” of table “mytable”

create table “core”.“mytable”(
"id_pk" bigserial default nextval(core.mytable_seq’::regclass) not null,
"col1" text not null,
"col2" bigint default nextval(core.mytable_seq’::regclass) not null,
"col3" timestamp with time zone not null,
"col4" **timestamp with time zone not null
** )
with (oids=true)
;

I couldn’t find the template to override this though, could you please advise how to work around.

Thanks,

/g


#2

Hello,

how this table was created? Did you reverse engineered or it was created by model update? TDM does not generate default value for the data type BigSerial by default and if you reverse table from DB the data type bigserial will be replaced by bigint with the default value.

Regards,

Dave