Re: [PATCH 4/4] Add tests to dblink covering use of COPY TO FUNCTION

Jeff Davis <pgsql@j-davis.com>

From: Jeff Davis <pgsql@j-davis.com>
To: Pavel Stehule <pavel.stehule@gmail.com>
Cc: Daniel Farina <drfarina@gmail.com>, Hannu Krosing <hannu@krosing.net>, Greg Smith <greg@2ndquadrant.com>, Robert Haas <robertmhaas@gmail.com>, Daniel Farina <dfarina@truviso.com>, pgsql-hackers@postgresql.org
Date: 2009-11-26T07:18:55Z
Lists: pgsql-hackers
On Thu, 2009-11-26 at 05:01 +0100, Pavel Stehule wrote:
> It working like:
> 
> 1. EXECUTE SELECT 0 FROM generate_series(1,...);
> 2. STORE RESULT TO TABLE zero;
> 3. EXECUTE SELECT 1/i FROM zero;
> 4. STORE RESULT TO TABLE tmp;
> 
> Problem is in seq execution. Result is stored to destination after
> execution - so any materialisation is necessary,
> 

My example showed that steps 3 and 4 are not executed sequentially, but
are executed together. If 3 was executed entirely before 4, then the
statement:
  insert into tmp select 1/i from zero;
would have to read the whole table "zero" before an error is
encountered.

However, the statement errors immediately, showing that steps 3 and 4
are pipelined.

Regards,
	Jeff Davis