Re: insert without oids

From: Michael Stone <mstone+postgres(at)mathom(dot)us>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: insert without oids
Date: 2006-01-13 22:48:01
Message-ID: 20060113224800.GJ1408@mathom.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Fri, Jan 13, 2006 at 04:29:15PM -0500, Neil Conway wrote:
>There's really no additional operations required:
>INSERT INTO t2 VALUES (currval('t1_id_seq'), ...);
>You need a separate SELECT if you want to use the generated sequence
>value outside the database,

That would, of course, be the goal. IOW, if you have a table which has
data which is unique only for the serial column, the old syntax provided
a way to refer to the newly inserted row uniquely without any additional
operations.

>although the INSERT ... RETURNING extension will avoid that

That sounds promising. I'll have to put the TODO list on my todo list.
:)

Mike Stone

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Jim C. Nasby 2006-01-13 23:34:54 Re: Slow query with joins
Previous Message Neil Conway 2006-01-13 21:29:15 Re: insert without oids