Re: easy way to insert same value into 2 columns

Shridhar Daithankar <shridhar_daithankar@persistent.co.in>

From: Shridhar Daithankar <shridhar_daithankar@persistent.co.in>
To: Postgres general mailing list <pgsql-general@postgresql.org>
Date: 2003-10-16T10:50:08Z
Lists: pgsql-general
Sebastian Boeck wrote:
> Thanks a lot, but is it save to use?
> 
> Do i always get the same value, even if an other insert is changing the 
> sequence >public.zeit_id_seq< just at the same time?

You can write a before insert trigger where you retrieve sequence value once and 
set for two fields. That way it will ensure that both the fields would get same 
value.

  HTH

  Shridhar