From: | Edmund Dengler <edmundd(at)eSentire(dot)com> |
---|---|
To: | Erik Price <eprice(at)ptc(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: LAST_INSERT_ID equivalent |
Date: | 2003-06-12 17:35:00 |
Message-ID: | Pine.BSO.4.44.0306121320001.22131-100000@cyclops4.esentire.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Greetings all!
I believe
select currval('sequence_name');
should satisfy your needs. Within a transaction it will stay the same.
Regards!
Ed
On Thu, 12 Jun 2003, Erik Price wrote:
> I have a table with a SEQUENCE on it that increments the primary key (a
> BIGINT column) of the table whenever a new insert is performed.
>
> Is there a way to determine the last incremented value, so that if I do
> an insert, I can record the primary key of the record somewhere? I'm
> interested in any technique for doing this, but especially a
> JDBC-specific solution.
>
> Sorry if the answer should be obvious but I am coming from MySQL and
> trying to learn the ANSI equivalent of the MySQL features.
>
>
>
> Thanks,
>
>
> Erik
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
>
From | Date | Subject | |
---|---|---|---|
Next Message | Justin Clift | 2003-06-12 17:35:04 | Re: Postgres performance comments from a MySQL user |
Previous Message | Justin Clift | 2003-06-12 17:29:37 | Re: [HACKERS] SAP and MySQL ... [and Benchmark] |