| From: | Rory Campbell-Lange <mail(at)campbell-lange(dot)net> | 
|---|---|
| To: | Rod Kreisler <rod(at)23net(dot)net> | 
| Cc: | Rory Campbell-Lange <mail(at)campbell-lange(dot)net>, pgsql-novice(at)postgresql(dot)org | 
| Subject: | Re: Return serial from insert | 
| Date: | 2002-11-08 16:02:07 | 
| Message-ID: | 20021108160207.GC15280@campbell-lange.net | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-novice | 
The problem is that I need to use the id for naming an image file.
Consequently I need the id from the insert. You will note (from my
original messgage) that I'm already using a SERIAL type field for the id
column.
On 08/11/02, Rod Kreisler (rod(at)23net(dot)net) wrote:
> You should get the nextval() from the sequence and use that for the new
> insert and all related inserts.
> 
> > -----Original Message-----
> > From: pgsql-novice-owner(at)postgresql(dot)org
> > [mailto:pgsql-novice-owner(at)postgresql(dot)org]On Behalf Of Rory
> > Campbell-Lange
> > Sent: Friday, November 08, 2002 10:30 AM
> > To: pgsql-novice(at)postgresql(dot)org
> > Subject: [NOVICE] Return serial from insert
> >
> >
> > I would like to return the autoincremented serial number resulting from
> > a new insert into a table, ideally as a result from the insert
> > statement.
-- 
Rory Campbell-Lange 
<rory(at)campbell-lange(dot)net>
<www.campbell-lange.net>
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Rod Kreisler | 2002-11-08 16:23:20 | Re: Return serial from insert | 
| Previous Message | Rod Kreisler | 2002-11-08 15:49:46 | Re: Return serial from insert |