Re: INSERT to partitioned table doesn't return row count

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Kris Deugau <kdeugau(at)vianet(dot)ca>, PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: INSERT to partitioned table doesn't return row count
Date: 2014-12-03 20:28:59
Message-ID: 547F728B.2000504@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 12/03/2014 11:19 AM, Kris Deugau wrote:
> Is it possible to return the number of rows inserted to a partitioned
> table set up as per the examples on
> http://www.postgresql.org/docs/9.1/interactive/ddl-partitioning.html, in
> the same way as if you inserted directly into a target table?
>
> I can sort of see why it returns 0, because 0 rows are actually inserted
> in the parent table, but I'd prefer not to have to make all the code
> around this use case partition-aware; most of it isn't mine.

I have not used partitioned tables enough, but it would seem this is
covered here:

http://www.postgresql.org/docs/9.3/interactive/sql-select.html

table_name

The name (optionally schema-qualified) of an existing table or
view. If ONLY is specified before the table name, only that table is
scanned. If ONLY is not specified, the table and all its descendant
tables (if any) are scanned. < ***>Optionally, * can be specified after
the table name to explicitly indicate that descendant tables are
included.<***>

>
> I tried modifying the last RETURN line in the trigger function but
> couldn't find anything that was even valid syntax.
>
> -kgd
>
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G Johnston 2014-12-03 20:48:14 Re: INSERT to partitioned table doesn't return row count
Previous Message Michael Nolan 2014-12-03 20:05:32 Re: Merge rows based on Levenshtein distance