Re: INSERT RETURNING and partitioning

From: Thom Brown <thombrown(at)gmail(dot)com>
To: "pdovera(at)tiscali(dot)it" <pdovera(at)tiscali(dot)it>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: INSERT RETURNING and partitioning
Date: 2010-07-20 14:51:44
Message-ID: AANLkTileHFSifQq3UKDPKqu-5nAldmZyhGoh6TL4g5db@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 20 July 2010 14:42, pdovera(at)tiscali(dot)it <pdovera(at)tiscali(dot)it> wrote:
> Hi all,
> I've noticed that an insert command with returning clause returns an
> empty result set if done on a master table. Instead the same insert
> with returning on partitioned tables works correctly.
>
> Do you know if it's a normal action? I'm doing something wrong?
>
> The partitioning works correctly with all kind of SQL commands:
> select, delete, update and "normal" insert.
>
> I've read the manual and it reports this:
> "The optional RETURNING clause causes INSERT to compute and return
> value(s) based on each row actually inserted. This is primarily useful
> for obtaining values that were supplied by defaults, such as a serial
> sequence number. However, any expression using the table's columns is
> allowed. The syntax of the RETURNING list is identical to that of the
> output list of SELECT."
>
> but nothing about partitioning ...
>
> Regards,
> Paolo
>
> PS: I'm using PostgreSQL 8.3.4 on x86 Linux box
>
>

Yes, that should work even on partitioned tables. Could you provide
some sample SQL you're using?

Thom

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alban Hertroys 2010-07-20 15:35:03 Re: Need a better way to do my constraints
Previous Message Gauthier, Dave 2010-07-20 14:19:09 Need a better way to do my constraints