Re: [GENERAL] getting the currval of a sequence

From: "James Oden" <joden(at)lee(dot)k12(dot)nc(dot)us>
To: "dustin sallings" <dustin(at)spy(dot)net>, "Fran Fabrizio" <fran(at)primary(dot)net>
Cc: <pgsql-general(at)postgreSQL(dot)org>
Subject: Re: [GENERAL] getting the currval of a sequence
Date: 1998-08-14 11:22:43
Message-ID: 004201bdc775$e78201c0$01cc0cac@Yehudah.lee.k12.nc.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>On Fri, 14 Aug 1998, Fran Fabrizio wrote:
>
> If you've recently done an insert and want to know what the value
>was, you can do this:
>
> select last_value from mysequence;

Alternatively, you can get your key from the sequence before you insert, and
override the default value of the key (they will be the same only now you
explicitly got it). Now that you know what the key value use, after you
insert it you can do anything you want to with it. To do this just do:

select nextval ('sequencename');

...james

Browse pgsql-general by date

  From Date Subject
Next Message 윤영철 1998-08-14 13:36:29
Previous Message Guido Piazzi 1998-08-14 09:36:57 Re: [GENERAL] More details on Database corruption