From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | David G Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PL/pgSQL support to define multi variables once |
Date: | 2014-06-13 15:44:54 |
Message-ID: | CAFj8pRCfry3Uq02wXSpwz4WRpSpy7+LFzGANwfP3xcZO+4Bk5Q@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
2014-06-13 17:32 GMT+02:00 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
> David G Johnston <david(dot)g(dot)johnston(at)gmail(dot)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.
>
I don't think so this feature is 100% necessary, but a few users requested
some more compressed form of variable declarations.
we can allow multi variable declaration without initial value specification
so "a,b,c text" can be valid, and "a,b,c text := 'hello'" not
It is just step to users who knows this feature from others languages.
Regards
Pavel
>
> regards, tom lane
>
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>
From | Date | Subject | |
---|---|---|---|
Next Message | David Johnston | 2014-06-13 15:57:06 | Re: PL/pgSQL support to define multi variables once |
Previous Message | Alvaro Herrera | 2014-06-13 15:39:44 | Re: PL/pgSQL support to define multi variables once |