Re: PL/pgSQL support to define multi variables once - Mailing list pgsql-hackers

From Tom Lane
Subject Re: PL/pgSQL support to define multi variables once
Date
Msg-id 26594.1402673561@sss.pgh.pa.us
Whole thread Raw
In response to Re: PL/pgSQL support to define multi variables once  (David G Johnston <david.g.johnston@gmail.com>)
Responses Re: PL/pgSQL support to define multi variables once  (Pavel Stehule <pavel.stehule@gmail.com>)
Re: PL/pgSQL support to define multi variables once  (David Johnston <david.g.johnston@gmail.com>)
List pgsql-hackers
David G Johnston <david.g.johnston@gmail.com> writes:
> Tom Lane-2 wrote
>> At the very least I think we should stay away from this syntax until
>> the SQL committee understand it better than they evidently do today.
>> I don't want to implement it and then get caught by a future
>> clarification that resolves the issue differently than we did.

> Its not quite as unclear as you make it out to be:

Yes it is.

> Though I suppose someone might want to do the following:
> random_1, random_2, random_3 float := random(1234);
> The decision to copy, not re-execute, is safer to use as the behavior and
> force explicitness in the re-execute situation.

I would agree with that argument, if we both sat on the SQL committee and
were discussing how to resolve the ambiguity.  We don't, and we have no
good way to predict what they'll do (when and if they do anything :-().

The problem I've got is that a literal reading of the spec seems to
suggest multiple evaluation, since "DV" appears to refer to the syntactic
construct representing the initializer, not its evaluated value.  It's
hard to argue that the spec isn't telling us to do this:
    SET random_1 = random(1234);    SET random_2 = random(1234);    SET random_3 = random(1234);

That's not the reading I want, and it's not the reading you want either,
but there is nothing in the existing text that justifies single
evaluation.  So I think we'd be well advised to sit on our hands until
the committee clarifies that.  It's not like there is some urgent reason
to have this feature.
        regards, tom lane



pgsql-hackers by date:

Previous
From: David G Johnston
Date:
Subject: Re: PL/pgSQL support to define multi variables once
Next
From: "David E. Wheeler"
Date:
Subject: Re: make check For Extensions