Re: INSERT ... RETURNING in v8.2

From: PFC <lists(at)peufeu(dot)com>
To: "Tom Allison" <tom(at)tacocat(dot)net>, "Vincenzo Romano" <vincenzo(dot)romano(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: INSERT ... RETURNING in v8.2
Date: 2007-06-16 16:04:08
Message-ID: op.tt0uw6ugcigqcu@apollo13
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 *)

In response to

Browse pgsql-general by date

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