From: | "Diego Schulz" <dschulz(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: INSERT with RETURNING clause inside SQL function |
Date: | 2008-11-04 03:26:10 |
Message-ID: | 47dcfe400811031926s1a3f2b50la22e2b7e9931b65e@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Mon, Nov 3, 2008 at 10:24 PM, Raymond O'Donnell <rod(at)iol(dot)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(at)iol(dot)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!
From | Date | Subject | |
---|---|---|---|
Next Message | Craig Ringer | 2008-11-04 03:31:01 | Re: I'm puzzled by a foreign key constraint problem |
Previous Message | Craig Ringer | 2008-11-04 02:31:45 | Re: Are there plans to add data compression feature to postgresql? |