Re: COPY (query) TO file - Mailing list pgsql-hackers

From Tom Lane
Subject Re: COPY (query) TO file
Date
Msg-id 15839.1149346604@sss.pgh.pa.us
Whole thread Raw
In response to Re: COPY (query) TO file  (Greg Stark <gsstark@mit.edu>)
Responses Re: COPY (query) TO file  (Greg Stark <gsstark@mit.edu>)
Re: COPY (query) TO file  (Andrew Dunstan <andrew@dunslane.net>)
List pgsql-hackers
Greg Stark <gsstark@mit.edu> writes:
> PFC <lists@peufeu.com> writes:
>> MySQL already does this for INSERT :
>> INSERT INTO x (a,b) VALUES (1,2), (3,4), (5,6)...;

> Does MySQL really let you stream that? Trying to do syntax like that in
> Postgres wouldn't work because the parser would try to build up a parse tree
> for the whole statement before running the command.

A quick look at MySQL's grammar doesn't show any indication that they
don't build a full parse tree too.

The above syntax is SQL-standard, so we ought to support it sometime,
performance benefits or no.  I agree it might be tricky to avoid eating
an unreasonable amount of memory for a very long list in Postgres :-(

Supporting VALUES only in INSERT would be relatively trivial BTW,
but the spec actually thinks it should be allowed as a <table spec>
in FROM ...
        regards, tom lane


pgsql-hackers by date:

Previous
From: Greg Stark
Date:
Subject: Re: COPY (query) TO file
Next
From: PFC
Date:
Subject: Re: COPY (query) TO file