Re: easy way to insert same value into 2 columns

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Sebastian Boeck <sebastianboeck(at)freenet(dot)de>
Cc: Csaba Nagy <nagy(at)ecircle-ag(dot)com>, Postgres general mailing list <pgsql-general(at)postgresql(dot)org>
Subject: Re: easy way to insert same value into 2 columns
Date: 2003-10-16 17:20:50
Message-ID: 20031016172050.GD28009@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Oct 16, 2003 at 13:53:27 +0200,
Sebastian Boeck <sebastianboeck(at)freenet(dot)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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2003-10-16 17:33:41 Re: ShmemAlloc errors
Previous Message Joseph Shraibman 2003-10-16 17:15:12 Re: ShmemAlloc errors