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

From: Misa Simic <misa(dot)simic(at)gmail(dot)com>
To: Xiaoning Xu <xixu(at)bcgsc(dot)ca>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: [partition table] python fetchall or fetchone function can not get the returning rows
Date: 2011-12-21 23:20:56
Message-ID: -823474135809961425@unknownmsgid
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Xiaoning,

I need to say i don't have experience with RETURNING... So don't know
what could be wrong...

But the way how we usually deal with same issue is:
Serial column has sequence next value as default value... So usually we
first take next seq value and in insert we include pk column with taken
value - then the same value use later in other tables as fk...

Kind Regards,

Misa

Sent from my Windows Phone From: Xiaoning Xu
Sent: 21 December 2011 22:31
To: pgsql-general(at)postgresql(dot)org
Subject: [GENERAL] [partition table] python fetchall or fetchone
function can not get the returning rows
Hello,

I have a problem concerning the partition table.
When I store a record into one of the partition and use "RETURNING
table_id" or "RETURNING *",
I expect the same result when calling fetchall or fetchone function as
not using partition.
However, it simply returns nothing.

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.

Thank you in advance!
Xiaoning

Browse pgsql-general by date

  From Date Subject
Next Message Roger Leigh 2011-12-21 23:26:46 Re: Escaping input from COPY
Previous Message Josh Kupershmidt 2011-12-21 23:16:42 Re: Escaping input from COPY