Re: Getting last insert value

From: Theodore Petrosky <tedpet5(at)yahoo(dot)com>
To: Yasir Malik <ymalik(at)cs(dot)stevens-tech(dot)edu>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Getting last insert value
Date: 2003-11-15 20:54:03
Message-ID: 20031115205403.54792.qmail@web41007.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


what does that mean the 'last row'? if client 1
inserts then client 2, the last row is client 2. do
you want to know what row client 1 inserted?
Personally I think your question is too broad. What
are you trying to accomplish?

Ted

--- Yasir Malik <ymalik(at)cs(dot)stevens-tech(dot)edu> wrote:
> Hello,
> I have a table with many fields, and one of the
> fields is of type serial.
> I will do many inserts, and there will be many
> repeats of the other fields
> in the table, but, obviously, the serial field will
> be unique for all the
> rows. How can I get the value of serial field of
> the last row I inserted.
> I know I can select the maximum value from the
> serial field, but is there
> a better way, preferably something that takes
> constant time.
> Thanks,
> Yasir Malik
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org

__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message ow 2003-11-16 01:50:08 Re: Programatically switching database
Previous Message Yasir Malik 2003-11-15 20:11:04 Re: Getting last insert value