Re: [GENERAL] Re: [BUGS] [HACKERS] COPY TO returning empty result with parallel ALTER TABLE

2014-11-04 Thread Bernd Helmle
--On 4. November 2014 17:18:14 -0500 Tom Lane wrote: Yeah, and I think that it's entirely reasonable for rewriting ALTER TABLEs to update the xmin of the rewritten tuples; after all, the output data could be arbitrarily different from what the previous transactions put into the table. But th

Re: [GENERAL] Re: [BUGS] [HACKERS] COPY TO returning empty result with parallel ALTER TABLE

2014-11-04 Thread Tom Lane
Andres Freund writes: > On 2014-11-04 13:51:23 -0500, Tom Lane wrote: >> Not sure. The OP's point is that in a SELECT, you do get unsurprising >> results, because a SELECT will acquire its execution snapshot after it's >> gotten AccessShareLock on the table. Arguably COPY should behave likewise.

Re: [BUGS] [HACKERS] COPY TO returning empty result with parallel ALTER TABLE

2014-11-04 Thread Andres Freund
On 2014-11-04 13:51:23 -0500, Tom Lane wrote: > Bernd Helmle writes: > > --On 3. November 2014 18:15:04 +0100 Sven Wegener > > wrote: > >> I've check git master and 9.x and all show the same behaviour. I came up > >> with the patch below, which is against curent git master. The patch > >> modifi

Re: [HACKERS] COPY TO returning empty result with parallel ALTER TABLE

2014-11-04 Thread Sven Wegener
On Tue, 4 Nov 2014, Tom Lane wrote: > Bernd Helmle writes: > > --On 3. November 2014 18:15:04 +0100 Sven Wegener > > wrote: > >> I've check git master and 9.x and all show the same behaviour. I came up > >> with the patch below, which is against curent git master. The patch > >> modifies the CO

Re: [HACKERS] COPY TO returning empty result with parallel ALTER TABLE

2014-11-04 Thread Sven Wegener
On Tue, 4 Nov 2014, Bernd Helmle wrote: > --On 3. November 2014 18:15:04 +0100 Sven Wegener > wrote: > > > I've check git master and 9.x and all show the same behaviour. I came up > > with the patch below, which is against curent git master. The patch > > modifies the COPY TO code to create a ne

Re: [HACKERS] COPY TO returning empty result with parallel ALTER TABLE

2014-11-04 Thread Andrew Dunstan
On 11/04/2014 01:51 PM, Tom Lane wrote: Bernd Helmle writes: --On 3. November 2014 18:15:04 +0100 Sven Wegener wrote: I've check git master and 9.x and all show the same behaviour. I came up with the patch below, which is against curent git master. The patch modifies the COPY TO code to crea

Re: [HACKERS] COPY TO returning empty result with parallel ALTER TABLE

2014-11-04 Thread Tom Lane
Bernd Helmle writes: > --On 3. November 2014 18:15:04 +0100 Sven Wegener > wrote: >> I've check git master and 9.x and all show the same behaviour. I came up >> with the patch below, which is against curent git master. The patch >> modifies the COPY TO code to create a new snapshot, after acquir

Re: [HACKERS] COPY TO returning empty result with parallel ALTER TABLE

2014-11-04 Thread Bernd Helmle
--On 3. November 2014 18:15:04 +0100 Sven Wegener wrote: I've check git master and 9.x and all show the same behaviour. I came up with the patch below, which is against curent git master. The patch modifies the COPY TO code to create a new snapshot, after acquiring the necessary locks on th

[HACKERS] COPY TO returning empty result with parallel ALTER TABLE

2014-11-03 Thread Sven Wegener
Hi all, we experienced what seems to be a bug in the COPY TO implementation. When a table is being rewritten by an ALTER TABLE statement, a parallel COPY TO results in an empty result. Consider the following table data: CREATE TABLE test (id INTEGER NOT NULL, PRIMARY KEY (id)); INSERT INTO t