Re: easy way to insert same value into 2 columns
Bruno Wolff III <bruno@wolff.to>
From: Bruno Wolff III <bruno@wolff.to>
To: Sebastian Boeck <sebastianboeck@freenet.de>
Cc: Csaba Nagy <nagy@ecircle-ag.com>, Postgres general mailing list <pgsql-general@postgresql.org>
Date: 2003-10-16T17:20:50Z
Lists: pgsql-general
On Thu, Oct 16, 2003 at 13:53:27 +0200, Sebastian Boeck <sebastianboeck@freenet.de> wrote: > Csaba Nagy wrote: > >I can't 100% say it's safe to use, but no, other inserts will not > >influence the value, because currval will return the last sequence value > >used by the current session (i.e. the current connection). And of course > >you only have concurrent inserts using different connection, right ? > > > >HTH, > >Csaba. > > Yes, that' right. > > Thanks As mentioned earlier, the problem is with concurrent inserts, but rather with which default expression gets calculated first. Today you are likely to get predictable behavior out of this, but if you do an alter table or perhaps upgrade to a new version of postgres, your code may break.