Small int autoincrement columns ? - Mailing list pgsql-hackers

From Constantin Teodorescu
Subject Small int autoincrement columns ?
Date
Msg-id 3649A2EA.138D97C0@flex.ro
Whole thread Raw
List pgsql-hackers
There are many cases when they are small lookup tables with few records
and detail tables with a lot of records.
In that cases it would be better to have an int2 autoincrement fields
for the lookup tables, not an int4.

create table goods(id int2 default nextval('goodies_seq'), name text);

does not work. Also,

create table goods(create table goods(id int2 default
nextval('goodies_seq'), name text);name text);

doesn't work either.

There is a chance to define a sql function next_goods_id returning int4
as 'select nextval('goodies_seq')::int2' but it isn't so nice.

BTW, shouldn't id int2 default nextval('goodies_seq')::int2 work ?

Constantin Teodorescu
FLEX Consulting Braila, ROMANIA


pgsql-hackers by date:

Previous
From: "Taral"
Date:
Subject: RE: [HACKERS] CORBA interface in backend?
Next
From: Zsolt Varga
Date:
Subject: Re: [HACKERS] linux libc6 & pgsql 6.4