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: Insert result does not match record count
Date: 2013-07-19 22:20:13
Message-ID: EE352A4C-561A-49B3-82F5-C7C7FB068AA9@ebureau.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Hi all,

I am moving some data from one table to another in 9.2.4, and keep seeing this strange scenario:

insert into newtable select data from oldtable where proc_date >= x and proc_date < y;

INSERT 0 78551642

select count(*) from newtable where proc_date >= x and proc_date < y;
count
-----------
4373518938

select count(*) from oldtable where proc_date >= x and proc_date < y;

count
-----------
4373518938

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.

Has anyone else ever seen this before? Should I be concerned?

Thanks,
Natalie

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2013-07-19 23:14:48 Re: Insert result does not match record count
Previous Message bricklen 2013-07-19 22:20:12 Re: Reply: Can we specify transaction level when connectting toexternal postgresql server via postgres_fdw

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2013-07-19 22:37:14 Isn't PLy_spi_execute_fetch_result completely broken?
Previous Message Karol Trzcionka 2013-07-19 21:04:17 Re: GSOC13 proposal - extend RETURNING syntax