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!