Small int autoincrement columns ?

From: Constantin Teodorescu <teo(at)flex(dot)ro>
To: "pgsql-hackers(at)postgreSQL(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Small int autoincrement columns ?
Date: 1998-11-11 14:44:58
Message-ID: 3649A2EA.138D97C0@flex.ro
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Browse pgsql-hackers by date

  From Date Subject
Next Message The Hermit Hacker 1998-11-11 19:30:06 Re: [HACKERS] CORBA interface in backend?
Previous Message Zsolt Varga 1998-11-11 09:37:54 Re: [HACKERS] linux libc6 & pgsql 6.4