Re: INSERT ... RETURNING in v8.2 - Mailing list pgsql-general

From PFC
Subject Re: INSERT ... RETURNING in v8.2
Date
Msg-id op.tt0uw6ugcigqcu@apollo13
Whole thread Raw
In response to Re: INSERT ... RETURNING in v8.2  (Tom Allison <tom@tacocat.net>)
List pgsql-general
> Holy Crud!
> you mean to tell me I can replace:
>
> insert into table(string) values(('one'),('two'),('three'));
> select idx from table where string in ('one','two','three');

    Yes.

    A smart ORM library should, when you create a new database object from
form values, use INSERT RETURNING to grab all the default values (SERIALs,
DEFAULTs, trigger-generated stuff etc). This is much more elegant than
digging to find the sequence name to currval() it !

    I think this feature is priceless (but it would be even better if I could
do INSERT INTO archive (DELETE FROM active WHERE blah RETURNING *)

pgsql-general by date:

Previous
From: Raymond O'Donnell
Date:
Subject: PHP sucks!! - was: persistent db connections in PHP
Next
From: PFC
Date:
Subject: Re: What O/S or hardware feature would be useful for databases?