pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Luis Sousa <llsousa@ualg.pt>
To: Michiel Lange <michiel@minas.demon.nl>
Cc: pgsql-sql@postgresql.org
Subject: Re: trying to learn plpqsql... so please forgive..
Date: Wed, 20 Nov 2002 09:44:53 +0000
Message-ID: <3DDB5995.7060403@ualg.pt> (raw)
References: <5.1.0.14.0.20021120010436.00b4c920@192.168.1.3>

> When I do an 'INSERT INTO <table> VALUES <row1,row2,row3>'
> and on the table is a serial primary key named p_key.
> As I want this number to be auto-generated, but use it as a 'customer 
> number', I want to create this function to return the value of this 
> insert. 


Try this:

SELECT currval(<sequence name from table>);

Luis Sousa

Attachments:

  smime.p7s (application/x-pkcs7-signature, 3.2K) download

view thread (7+ messages)  latest in thread

Message-ID: <3DDB5995.7060403@ualg.pt>
Permalink:  ../3DDB5995.7060403@ualg.pt/
Also on:    postgresql.org/message-id/3DDB5995.7060403@ualg.pt

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: llsousa@ualg.pt, michiel@minas.demon.nl
  Subject: Re: trying to learn plpqsql... so please forgive..
  In-Reply-To: <3DDB5995.7060403@ualg.pt>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox