From: Craig Ringer <ringerc@ringerc.id.au>
To: pgsql-sql@postgresql.org
Subject: Re: Partitioned Tables
Date: Wed, 13 Jun 2012 10:37:49 +0800
Message-ID: <4FD7FCFD.6010900@ringerc.id.au> (raw)
In-Reply-To: <20120613000545.GM19474@slacker.ja10629.home>
References: <20120613000545.GM19474@slacker.ja10629.home>
On 06/13/2012 08:05 AM, Wayne Cuddy wrote:
> I'm using partitioned tables where a child table is chosen based on a
> time stamp. One child table exists for each month.
>
> I move records from a temp table to the partitioned table via something like
> this:
>
> INSERT INTO parent_table SELECT * FROM temp_table;
>
> All works well but with when inserting to standard tables the insert
> result contains the number of records inserted. I've found that when I
> insert into partitioned tables the result is always zero.
Are you inserting directly into the partition? Or into the parent table?
If you're inserting into the parent, then it's true that no rows were
inserted into the parent; a trigger redirected the write into the child
table. Pg's handling of partitioning isn't yet sophisticated enough to
recognise that those rows got written to a child and thus still appeared
in the parent and report that.
As a workaround, ignore the insert count for partitioned tables, or
insert directly into the appropriate partition(s).
--
Craig Ringer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: ringerc@ringerc.id.au
Subject: Re: Partitioned Tables
In-Reply-To: <4FD7FCFD.6010900@ringerc.id.au>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox