Re: [HACKERS] getting new serial value of serial insert
От | Ed Loehr |
---|---|
Тема | Re: [HACKERS] getting new serial value of serial insert |
Дата | |
Msg-id | 3821B622.FF93B1C1@austin.rr.com обсуждение исходный текст |
Ответ на | RE: [HACKERS] getting new serial value of serial insert ("Ansley, Michael" <Michael.Ansley@intec.co.za>) |
Список | pgsql-hackers |
I assume it is possible in pgsql to return the just-inserted serial value with a stored procedure. Stored procedures, though, would seem to be significantly more hassle vs. the INSERT-returns-serial approach. I share the concern about non-std SQL, though it seems the pgsql system (like most other RDBMS) is already loaded with non-std SQL precisely because the std has repeatedly been judged lacking for itches that needed scratching. As for concern about modifying INSERT semantics just for serial types, that too, I would normally share. A generalized solution is better. However, the pg serial type is already a special case, constructed by Postgres from other existing components unlike other types. For that reason, I think the case of facilitating an atomic return of the serial value from a SQL insert statement would provide pragmatic support for the key access mode to a special-case (non-std?) extension already present. For the same reason, it strikes me that the generalized ability to return any value from an INSERT should be treated as largely orthogonal to the special case serial type. Cheers. Ed "Ansley, Michael" wrote: > Why can't this simply be done with a stored proc? Or am I missing the boat? > Stored proc accepts parameters to insert, and returns whatever value you > want it to.
В списке pgsql-hackers по дате отправления: