From: | Jan Poslusny <pajout(at)gingerall(dot)cz> |
---|---|
To: | tony <tony(at)animaproductions(dot)com> |
Cc: | postgres list <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: getting currval from a sequence - BUG ? |
Date: | 2002-02-11 16:35:47 |
Message-ID: | 3C67F2E3.2040800@gingerall.cz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi,
select currval('sequence_name');
with quotes should help you. But my pg 7.1.2 throws error
"sequence_name.currval is not yet defined in this session" (possibly bug
?). If I use sequence before calling this (for instance "insert into
mytable values(nextval('sequence_name'));" ), all is OK.
pajout
Bruno Wolff III wrote:
> On Mon, Feb 11, 2002 at 11:42:31AM +0100,
> tony <tony(at)animaproductions(dot)com> wrote:
>
>>How does one get the last record from a series of records? I just need
>>the id field which is a sequence field
>>
>
> select max(id) from whatever;
> (This assumes the sequence hasn't rolled over.)
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2002-02-11 16:37:12 | Re: initdb - segmentation fault |
Previous Message | Tom Lane | 2002-02-11 16:20:03 | Re: SEMMAP |