Search Postgresql Archives

Re: INSERT ... RETURNING in v8.2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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 *)


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux