pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: André José Guergolet <AGuergolet@compugraf.com.br>
Cc: pgsql-sql@postgresql.org
Subject: Re: Insert Data and autonumeric field
Date: Thu, 01 Feb 2007 13:32:19 -0500
Message-ID: <20383.1170354739@sss.pgh.pa.us> (raw)
In-Reply-To: <E426DDFE0FB5634AA3C997254DCBDE4EDF3C91@cgexc04.compugraf.com.br>
References: <E426DDFE0FB5634AA3C997254DCBDE4EDF3C91@cgexc04.compugraf.com.br>

=?iso-8859-1?Q?Andr=E9_Jos=E9_Guergolet?= <AGuergolet@compugraf.com.br> writes:
> 		INSERT INTO table1 (date, field2, field3) VALUES (now,'value2','value3');
> 		SELECT last_value FROM seq_table1;

You should never ever look directly at the sequence table (except
perhaps for manual debugging purposes).  I think you may have confused
this with use of the lastval() function --- currval() or sometimes
lastval() are the appropriate way to get the last-assigned value.

			regards, tom lane



view thread (3+ messages)  latest in thread

Message-ID: <20383.1170354739@sss.pgh.pa.us>
Permalink:  ../20383.1170354739@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/20383.1170354739@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, AGuergolet@compugraf.com.br
  Subject: Re: Insert Data and autonumeric field
  In-Reply-To: <20383.1170354739@sss.pgh.pa.us>

* 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