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