Re: INSERT with RETURNING clause inside SQL function
От | Diego Schulz |
---|---|
Тема | Re: INSERT with RETURNING clause inside SQL function |
Дата | |
Msg-id | 47dcfe400811031926s1a3f2b50la22e2b7e9931b65e@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: INSERT with RETURNING clause inside SQL function (Raymond O'Donnell <rod@iol.ie>) |
Ответы |
Re: INSERT with RETURNING clause inside SQL function
|
Список | pgsql-general |
On Mon, Nov 3, 2008 at 10:24 PM, Raymond O'Donnell <rod@iol.ie> wrote: > On 04/11/2008 01:20, Diego Schulz wrote: > >> I also tried this (somewhat silly) syntax to circumvent the issue >> without resorting in currval: > > Just curious - what have you got against currval()? It seems to me that > it would make your life easier.... > > Ray. > > > ------------------------------------------------------------------ > Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland > rod@iol.ie > Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals > ------------------------------------------------------------------ > I simply don't like having to cast from BIGINT to INTEGER, as currval returns BIGINT while the index of my table is INTEGER. I think isn't as readable and elegant as the single INSERT ... RETURNING value. Being the only choice at this time (that I'm aware of) I'm using something like this: SELECT CAST(CURRVAL('mytable_id_seq') AS INTEGER); If I can avoid messing with sequence manipulation functions, surely I will. Cheers!
В списке pgsql-general по дате отправления: