Hi. Currently sa does select after insert to get the new serial value?
Is my understanding correct? Thx

2008/6/7, Michael Bayer <[EMAIL PROTECTED]>:
>
>
> On Jun 6, 2008, at 9:11 PM, Cliff Wells wrote:
>
>>
>> Just an FYI, in PostgreSQL 8.2.4 they added a new feature "returning"
>> which can be used to avoid the need for an additional query (to get
>> the
>> value of serial columns) when inserting records:
>>
>> test=# create table foo ( id serial primary key not null, name text );
>>
>> test=# insert into foo ( name ) values ( 'test 1' ) returning id;
>> id
>> ----
>>  1
>> (1 row)
>>
>> test=# insert into foo ( name ) values ( 'test 2' ) returning *;
>> id |  name
>> ----+---------
>>  2 | test 2
>> (1 row)
>>
>>
>> Thought it would be worth mentioning.
>
> the PG dialect supports RETURNING;  I think its the "pg_returning"
> keyword argument to insert().
>
> Still remaining to do is to modify the PG dialect such that this is
> used automatically when available for the primary key columns, or
> perhaps in combination with a dialect agnostic "hint", so that the ORM
> makes usage of it implicitly.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to