Re: [GENERAL] calculated default

2006-11-16 Thread Hitoshi Harada
8 PM > To: pgsql-general@postgresql.org > Subject: [GENERAL] calculated default > > I have a table with a sequence as its primary key. > On insert I would like to have all its fields (except the primary key) > default to the last one in the table (order by id desc limit 1

Re: [GENERAL] calculated default

2006-11-16 Thread Richard Huxton
SunWuKung wrote: I have a table with a sequence as its primary key. On insert I would like to have all its fields (except the primary key) default to the last one in the table (order by id desc limit 1). I guess I should use a trigger to do this but I don't know how. I'm not sure you can really

[GENERAL] calculated default

2006-11-16 Thread SunWuKung
I have a table with a sequence as its primary key. On insert I would like to have all its fields (except the primary key) default to the last one in the table (order by id desc limit 1). I guess I should use a trigger to do this but I don't know how. Thanks for the help. SWK