On Thu, Jan 26, 2012 at 2:12 AM, panam <panam@gmx.net> wrote:
> CREATE TABLE tbl (ID bigint default nextval('global_seq') primary key,foo
> varchar,bar varchar); --in public schema
> CREATE TABLE schema1.tbl (LIKE public.tbl INCLUDING ALL); --draws ids from
> sequence in public schema
> CREATE TABLE schema2.tbl (LIKE public.tbl INCLUDING ALL); --draws ids from
> sequence in public schema
Yep, but you can do this more simply:
CREATE TABLE schema1.tbl (ID bigint default nextval('global_seq')
primary key,foo varchar,bar varchar)
CREATE TABLE schema2.tbl (ID bigint default nextval('global_seq')
primary key,foo varchar,bar varchar)
No need for the dummy table.
Obviously you would want better names than these ("global_seq" is a
really dumb name for a production environment!), but you knew that
already :)
ChrisA