Re: Insert result does not match record count

From: Natalie Wenz <nataliewenz(at)ebureau(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Insert result does not match record count
Date: 2013-07-22 15:44:27
Message-ID: AC771580-2486-416E-A681-1D7B8DE41DAD@ebureau.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

No triggers, no rules. It's just a very boring, vanilla table. I have had plenty of cases where the inserts fail because many of the data types are different in the new table, and there is some junk that fails the cast. And even though the insert result seems to indicate that it only inserted some of the rows, when I do a count of the records after the insert, I find the same number of records in the new as in the old table. So it appears to be working correctly, but it's unsettling to see the insert result not match. Do I trust the count, or the insert result? Could this be a sign of some kind of corruption? Not sure how worried I should be.

Cheers,
Natalie

On Jul 19, 2013, at 6:14 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Natalie Wenz <nataliewenz(at)ebureau(dot)com> writes:
>> I am moving some data from one table to another in 9.2.4, and keep seeing this strange scenario:
>> ...
>> So, my counts from the old and new tables match, but the result returned from the insert statement is sometimes a completely different number. (But not always.) I've checked my date ranges very carefully to make sure they match.
>
> Perhaps you've got triggers or rules on the target table that are
> suppressing some inserts?
>
> regards, tom lane
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Natalie Wenz 2013-07-22 16:12:34 Re: Insert result does not match record count
Previous Message sachin kotwal 2013-07-22 12:33:54 Re: Different transaction log for database/schema

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Smith 2013-07-22 15:58:36 Re: [PATCH] pgbench --throttle (submission 7 - with lag measurement)
Previous Message Tom Lane 2013-07-22 15:42:23 Re: Review: UNNEST (and other functions) WITH ORDINALITY