Skip site navigation (1) Skip section navigation (2)

Re: [NOVICE] Last ID Problem

From: "Mark Cave-Ayland" <m(dot)cave-ayland(at)webbased(dot)co(dot)uk>
To: "'Tom Lane'" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "'Alvaro Herrera'" <alvherre(at)dcc(dot)uchile(dot)cl>,"'Michael Fuhr'" <mike(at)fuhr(dot)org>,"'Mitch Pirtle'" <mitch(dot)pirtle(at)gmail(dot)com>,"'Tatsuo Ishii'" <t-ishii(at)sra(dot)co(dot)jp>, <pgsql-hackers(at)postgresql(dot)org>,<operationsengineer1(at)yahoo(dot)com>
Subject: Re: [NOVICE] Last ID Problem
Date: 2005-02-03 11:21:23
Message-ID: 9EB50F1A91413F4FA63019487FCD251DADF7@WEBBASEDDC.webbasedltd.local (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
Hi Tom,

> -----Original Message-----
> From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us] 
> Sent: 02 February 2005 15:35
> To: Mark Cave-Ayland
> Cc: 'Alvaro Herrera'; 'Michael Fuhr'; 'Mitch Pirtle'; 'Tatsuo 
> Ishii'; pgsql-hackers(at)postgresql(dot)org; operationsengineer1(at)yahoo(dot)com
> Subject: Re: [NOVICE] Last ID Problem


> No.  The thing everyone is ignoring here is that the INSERT 
> command tag format is not something we can just go and 
> change.  You certainly could not put anything in it that 
> wasn't an integer, and I'm not sure it would even be safe to 
> put a bigint.  So most of the cases you might actually want 
> (timestamp, bigserial, etc) would be ruled out.  Hardly worth 
> inventing such a feature.

OK, I didn't realise it was the command tag that was the issue here. I took
a look at the libpq source to see how the INSERT tag works and it looks like
it currently assumes a string of numbers. So as a minimum it would need some
form of protocol extension to get this work (which I see from the archives
that you were not keen to pursue).

> How is what you're suggesting more portable?

I was hoping that it would only require minimal change (but obviously that
is not the case). I think, out of the remaining options, that keeping with
currval() is going to be the best approach - I can't really see the benefit
of using a non-SQL standard command just for SQL insertion, mainly as you
and others have suggested for portability reasons :(

Kind regards,


WebBased Ltd
South West Technology Centre
Tamar Science Park
PL6 8BT 

T: +44 (0)1752 791021
F: +44 (0)1752 791023

In response to

pgsql-hackers by date

Next:From: Neil ConwayDate: 2005-02-03 14:00:21
Subject: Re: LWLockRelease
Previous:From: ITAGAKI TakahiroDate: 2005-02-03 10:25:55
Subject: Re: [PATCHES] WAL: O_DIRECT and multipage-writer (+ memory leak)

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group