"Pavel Stehule" <pavel.stehule@hotmail.com> writes:
>>>> x, y := r;
>
>>> That strikes me as a really bad idea. It weakens both syntax and
>>> semantic error checking, to accomplish how much?
>>
>> Could use PHP-style thingy:
>> LIST(x, y) := r;
Actually, ROW(x, y) would be the right spelling per SQL convention.
> It's inconsystency :-(.
> EXECUTE INTO and SELECT INTO use scalar of vectors without anything.
But in both of those cases there are required leading keywords to give
you some clue what's supposed to come next. Allowing bare x, y at the
start of a statement is just a recipe for misconstruing stuff that was
intended as something else and is one or two punctuation characters shy
of perfection.
There is also the problem of insufficient semantic cross-checking. A
record variable doesn't have any very well-defined order of fields, so
who's to say which value goes to x and which to y? For that matter,
if I just have
x := y
and y is a single-field rowtype, it'd be entirely unclear whether x is
to receive the row value or the field value.
I don't think this buys anything that is worth the can of worms we'd
be opening up. The extension for FOR might be worth doing, but not
the assignment change.
And, to reiterate Andrew's point, this entire discussion should have
been held before you wrote a line of code. It is utterly wrong
to be doing it in pgsql-patches.
regards, tom lane