Re: COPY IN as SELECT target

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: COPY IN as SELECT target
Date: 2009-12-19 15:32:42
Message-ID: 4B2CF21A.2070901@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> I think that there are two likely possibilities for the result format:
>
> * "Raw" data after just the de-escaping and column separation steps.
> Array of text is probably the right thing here, at least for a text COPY
> (doesn't seem to cover the binary case though).
>
> * The data converted to some specified row type.
>
> "RETURNING type-expression" is probably not good since it looks more
> like the second case than the first --- and in fact it could be outright
> ambiguous, what if your data actually is one column that is a text
> array?
>
> If we're willing to assume these are the *only* possibilities then we
> could use "COPY FROM ..." for the first and "COPY RETURNING type-list
> FROM ..." for the second. I'm a bit uncomfortable with that assumption
> though; it seems likely that we'll want to shoehorn in some more
> alternatives later. (Like, what about the binary case?)
>
>
>

Yeah. I think we need an explicit marker. The first of these cases is
the one I'm particularly interested in. I think you could actually get
the second from the first with a little more work anyway, but the "raw"
input as an array lets me get the things I can't easily get another way.

I think we're going to need some marker such as parentheses to
distinguish the second case. In that case, "RETURNING text[]" could be
the first case and "RETURNING (text[])" could be the second, but maybe
that's a bit too subtle. How about "RETURNING TYPE (type_list)" for the
second case?

cheers

andrew

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2009-12-19 15:52:56 Re: alpha3 release schedule?
Previous Message Jaime Casanova 2009-12-19 15:19:34 Re: Distinguish view and table problem