Re: INSERT with RETURNING clause inside SQL function
От | Diego Schulz |
---|---|
Тема | Re: INSERT with RETURNING clause inside SQL function |
Дата | |
Msg-id | 47dcfe400811040431u10da28acj4c8717a9382b47eb@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: INSERT with RETURNING clause inside SQL function (Tom Lane <tgl@sss.pgh.pa.us>) |
Список | pgsql-general |
On Tue, Nov 4, 2008 at 2:38 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote: > "Diego Schulz" <dschulz@gmail.com> writes: >> On Mon, Nov 3, 2008 at 10:24 PM, Raymond O'Donnell <rod@iol.ie> wrote: >>> Just curious - what have you got against currval()? It seems to me that >>> it would make your life easier.... > >> I simply don't like having to cast from BIGINT to INTEGER, > > Under what circumstances do you need an explicit cast? > > regards, tom lane > When I want the function to return the same type as the index of the table (normally SERIAL), and I have other functions that rely on the datatype returned. To avoid casting I can simply change the function's signature to return BIGINT (to match currval() return type) and the problem vanishes but.. then I have more functions that needs to be adapted. Maybe I'm a bit paranoid of BIGINT's performance penalty too, as the set of functions will be heavily used, but honestly, this fear completely lacks foundation. Just to make it clear, the main reason for this thread was curiosity :) Thank you for your time.
В списке pgsql-general по дате отправления: