Re: [partition table] fetchall or fetchone function can not get the returning rows

From: John R Pierce <pierce(at)hogranch(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: [partition table] fetchall or fetchone function can not get the returning rows
Date: 2011-12-22 04:05:57
Message-ID: 4EF2ACA5.507@hogranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 12/21/11 10:24 AM, Xiaoning Xu wrote:
> Since the serial primary key of my partition table is the FK of some other tables, I need to get the
> id after each insertion.
> My solution now is to select the max id from the parent table.
> I am wondering if there is any other alternatives to solve this problem.

curval('sequencename') after doing the insert will return the correct
value for this transaction, independent of any other concurrent
trnasactions that may be going on. your max() method would fail with
enough concurrency.

--
john r pierce N 37, W 122
santa cruz ca mid-left coast

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2011-12-22 04:57:49 Re: Trying to understand postgres crash
Previous Message John R Pierce 2011-12-22 04:00:48 Re: Help with Multiple Cluster on same host