Re: functional call named notation clashes with SQL feature

Lists: pgsql-hackers
From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Subject: functional call named notation clashes with SQL feature
Date: 2010-05-26 20:44:30
Message-ID: 1274906670.19408.22.camel@vanquo.pezone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

It turns out that the SQL standard uses the function call notation

foo(this AS that)

for something else:

<routine invocation> ::= <routine name> <SQL argument list>

<routine name> ::= [ <schema name> <period> ] <qualified identifier>

<SQL argument list> ::= <left paren> [ <SQL argument> [ { <comma> <SQL
argument> }... ] ] <right paren>

<SQL argument> ::= <value expression>
| <generalized expression>
| <target specification>

<generalized expression> ::= <value expression> AS <path-resolved
user-defined type name>

In systems that have inheritance of composite types, this is used to
specify which type the value is supposed to be interpreted as (for
example, to treat the value as a supertype).

Seems kind of bad to overload this with something completely different.
What should we do?


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-26 22:52:33
Message-ID: 4BFDA631.7030309@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Peter Eisentraut wrote:
> It turns out that the SQL standard uses the function call notation
>
> foo(this AS that)
>
> for something else:
>
> <routine invocation> ::= <routine name> <SQL argument list>
>
> <routine name> ::= [ <schema name> <period> ] <qualified identifier>
>
> <SQL argument list> ::= <left paren> [ <SQL argument> [ { <comma> <SQL
> argument> }... ] ] <right paren>
>
> <SQL argument> ::= <value expression>
> | <generalized expression>
> | <target specification>
>
> <generalized expression> ::= <value expression> AS <path-resolved
> user-defined type name>
>
> In systems that have inheritance of composite types, this is used to
> specify which type the value is supposed to be interpreted as (for
> example, to treat the value as a supertype).
>
> Seems kind of bad to overload this with something completely different.
> What should we do?
>
>

I think we should fix it now. Quick thought: maybe we could use FOR
instead of AS: select myfunc(7 for a, 6 for b); IIRC the standard's
mechanism for this is 'paramname => value', but I think that has
problems because of our possibly use of => as an operator - otherwise
that would be by far the best way to go.

cheers

andrew


From: alvherre <alvherre(at)commandprompt(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-26 23:09:21
Message-ID: 1274915069-sup-2440@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Excerpts from Andrew Dunstan's message of mié may 26 18:52:33 -0400 2010:

> I think we should fix it now. Quick thought: maybe we could use FOR
> instead of AS: select myfunc(7 for a, 6 for b); IIRC the standard's
> mechanism for this is 'paramname => value', but I think that has
> problems because of our possibly use of => as an operator - otherwise
> that would be by far the best way to go.

I think we were refraining from => because the standard didn't specify
this back then -- AFAIU this was introduced very recently. But now that
it does, and that the syntax we're implementing conflicts with a
different feature, it seems wise to use the standard-mandated syntax.

The problem with the => operator seems best resolved as not accepting
such an operator in a function parameter, which sucks but we don't seem
to have a choice. Perhaps we could allow "=>" to resolve as the
operator for the case the user really needs to use it; or a
schema-qualified operator.

--
Álvaro Herrera <alvherre(at)commandprompt(dot)com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


From: "David E(dot) Wheeler" <david(at)kineticode(dot)com>
To: alvherre <alvherre(at)commandprompt(dot)com>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-26 23:34:52
Message-ID: 0FFF5551-7836-4815-965D-08E63FC53D48@kineticode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On May 26, 2010, at 4:09 PM, alvherre wrote:

> The problem with the => operator seems best resolved as not accepting
> such an operator in a function parameter, which sucks but we don't seem
> to have a choice. Perhaps we could allow "=>" to resolve as the
> operator for the case the user really needs to use it; or a
> schema-qualified operator.

I think requiring schema-qualification is an acceptable compromise.

Best,

David


From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: alvherre <alvherre(at)commandprompt(dot)com>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-26 23:39:21
Message-ID: 4BFDB129.1050107@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 27/05/10 02:09, alvherre wrote:
> Excerpts from Andrew Dunstan's message of mié may 26 18:52:33 -0400 2010:
>
>> I think we should fix it now. Quick thought: maybe we could use FOR
>> instead of AS: select myfunc(7 for a, 6 for b); IIRC the standard's
>> mechanism for this is 'paramname => value', but I think that has
>> problems because of our possibly use of => as an operator - otherwise
>> that would be by far the best way to go.
>
> I think we were refraining from => because the standard didn't specify
> this back then -- AFAIU this was introduced very recently. But now that
> it does, and that the syntax we're implementing conflicts with a
> different feature, it seems wise to use the standard-mandated syntax.
>
> The problem with the => operator seems best resolved as not accepting
> such an operator in a function parameter, which sucks but we don't seem
> to have a choice. Perhaps we could allow "=>" to resolve as the
> operator for the case the user really needs to use it; or a
> schema-qualified operator.

AFAIU, the standard doesn't say anything about named parameters. Oracle
uses =>, but as you said, that's ambiguous with the => operator.

+1 for FOR.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: alvherre <alvherre(at)commandprompt(dot)com>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-27 00:21:11
Message-ID: 5084.1274919671@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

alvherre <alvherre(at)commandprompt(dot)com> writes:
> The problem with the => operator seems best resolved as not accepting
> such an operator in a function parameter, which sucks but we don't seem
> to have a choice.

"Sucks" is not the word; "utterly unacceptable" is the word. Having an
expression mean different things depending on context is a recipe for
unbelievable nightmares. Can you imagine dealing with that in a query
generator for example? Or even ruleutils.c?

If we go with the spec's syntax I think we'd have no realistic choice
except to forbid => altogether as an operator name. (And no, I'm not
for that.)

regards, tom lane


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: alvherre <alvherre(at)commandprompt(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-27 00:57:50
Message-ID: AANLkTilmf1qkSLiBKd8uyVJ0-GKvHXtcFHR9gfLAWnhn@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, May 26, 2010 at 8:21 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> alvherre <alvherre(at)commandprompt(dot)com> writes:
>> The problem with the => operator seems best resolved as not accepting
>> such an operator in a function parameter, which sucks but we don't seem
>> to have a choice.
>
> "Sucks" is not the word; "utterly unacceptable" is the word.  Having an
> expression mean different things depending on context is a recipe for
> unbelievable nightmares.  Can you imagine dealing with that in a query
> generator for example?  Or even ruleutils.c?
>
> If we go with the spec's syntax I think we'd have no realistic choice
> except to forbid => altogether as an operator name.  (And no, I'm not
> for that.)

I suppose the most painful thing about doing that is that it would
break hstore. Are there other commonly-used modules that rely on =>
as an operator name?

In spite of the difficulties, I'm reluctant to give up on it. I
always thought that the "AS" syntax was a crock and I'm not eager to
invent another crock to replace it. Being compatible with the SQL
standard and with Oracle is not to be taken lightly.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company


From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, alvherre <alvherre(at)commandprompt(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-27 01:06:17
Message-ID: 4BFDC589.1080507@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 27/05/10 03:57, Robert Haas wrote:
> Being compatible with the SQL
> standard and with Oracle is not to be taken lightly.

I seem to be alone believing that the SQL standard doesn't say anything
about named function parameters. Can someone point me to the relevant
section of the standard?

As evidence to the contrary:
http://archives.postgresql.org/pgsql-hackers/2009-08/msg00558.php

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: alvherre <alvherre(at)commandprompt(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-27 01:28:05
Message-ID: 5930.1274923685@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Wed, May 26, 2010 at 8:21 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> If we go with the spec's syntax I think we'd have no realistic choice
>> except to forbid => altogether as an operator name. (And no, I'm not
>> for that.)

> I suppose the most painful thing about doing that is that it would
> break hstore. Are there other commonly-used modules that rely on =>
> as an operator name?

There don't seem to be any other contrib modules that define => as an
operator name, but I'm not sure what's out there on pgfoundry or
elsewhere. The bigger issue to me is not so much hstore itself as that
this is an awfully attractive operator name for anything container-ish.
Wasn't the JSON-datatype proposal using => for an operator at one stage?
(The current wiki page for it doesn't seem to reflect any such idea,
though.) And I think I remember Oleg & Teodor proposing such an
operator in conjunction with some GIN-related idea or other.

> In spite of the difficulties, I'm reluctant to give up on it. I
> always thought that the "AS" syntax was a crock and I'm not eager to
> invent another crock to replace it. Being compatible with the SQL
> standard and with Oracle is not to be taken lightly.

Yeah, I know. Though this could end up being one of the bits of the
spec that we politely decline to follow, like upper-casing identifiers.
Still, it's a good idea to think again before we've set the release
in stone ...

regards, tom lane


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: alvherre <alvherre(at)commandprompt(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-27 01:38:54
Message-ID: AANLkTimAT7rLRIHY32D0aX1PuudOEtRWp57MFXE3H4Ru@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, May 26, 2010 at 9:28 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>> On Wed, May 26, 2010 at 8:21 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>> If we go with the spec's syntax I think we'd have no realistic choice
>>> except to forbid => altogether as an operator name.  (And no, I'm not
>>> for that.)
>
>> I suppose the most painful thing about doing that is that it would
>> break hstore.  Are there other commonly-used modules that rely on =>
>> as an operator name?
>
> There don't seem to be any other contrib modules that define => as an
> operator name, but I'm not sure what's out there on pgfoundry or
> elsewhere.  The bigger issue to me is not so much hstore itself as that
> this is an awfully attractive operator name for anything container-ish.
> Wasn't the JSON-datatype proposal using => for an operator at one stage?
> (The current wiki page for it doesn't seem to reflect any such idea,
> though.)  And I think I remember Oleg & Teodor proposing such an
> operator in conjunction with some GIN-related idea or other.
>
>> In spite of the difficulties, I'm reluctant to give up on it.  I
>> always thought that the "AS" syntax was a crock and I'm not eager to
>> invent another crock to replace it.  Being compatible with the SQL
>> standard and with Oracle is not to be taken lightly.
>
> Yeah, I know.  Though this could end up being one of the bits of the
> spec that we politely decline to follow, like upper-casing identifiers.
> Still, it's a good idea to think again before we've set the release
> in stone ...

Perhaps one idea would be to:

1. Invent a new crock for now.
2. Add a duplicate version of the hstore => operator with a different name.
3. Emit a warning whenever an operator called => is created.
4. Document that beginning in PG 9.1, we will no longer support => as
an operator name.

That's still going to cause a fair amount of pain, but certainly less
if we decide it now rather than later.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company


From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-27 06:48:53
Message-ID: AANLkTilLrP7eum-Dh3xDG8DzGsgRJbwylEeW_NcWl23p@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

>>
>
> I think we should fix it now.  Quick thought: maybe we could use FOR instead
> of AS: select myfunc(7 for a, 6 for b); IIRC the standard's mechanism for
> this is 'paramname => value', but I think that has problems because of our
> possibly use of => as an operator - otherwise that would be by far the best
> way to go.
>

What is advice of "FOR" instead "AS"?

it is exactly same.

Regards
Pavel

> cheers
>
> andrew
>
> --
> 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: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: alvherre <alvherre(at)commandprompt(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-27 06:50:18
Message-ID: AANLkTin2Yws6lOpo-lfcnSs2j-ZBxxMsD-hmZ29qnR8W@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

2010/5/27 Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>:
> On 27/05/10 02:09, alvherre wrote:
>>
>> Excerpts from Andrew Dunstan's message of mié may 26 18:52:33 -0400 2010:
>>
>>> I think we should fix it now.  Quick thought: maybe we could use FOR
>>> instead of AS: select myfunc(7 for a, 6 for b); IIRC the standard's
>>> mechanism for this is 'paramname =>  value', but I think that has
>>> problems because of our possibly use of =>  as an operator - otherwise
>>> that would be by far the best way to go.
>>
>> I think we were refraining from =>  because the standard didn't specify
>> this back then -- AFAIU this was introduced very recently.  But now that
>> it does, and that the syntax we're implementing conflicts with a
>> different feature, it seems wise to use the standard-mandated syntax.
>>
>> The problem with the =>  operator seems best resolved as not accepting
>> such an operator in a function parameter, which sucks but we don't seem
>> to have a choice.  Perhaps we could allow "=>" to resolve as the
>> operator for the case the user really needs to use it; or a
>> schema-qualified operator.
>
> AFAIU, the standard doesn't say anything about named parameters. Oracle uses
> =>, but as you said, that's ambiguous with the => operator.
>
> +1 for FOR.
>

I don't see any advantage of "FOR". We can change ir to support new
standard or don't change it.

Pavel

> --
>  Heikki Linnakangas
>  EnterpriseDB   http://www.enterprisedb.com
>
> --
> 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: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, alvherre <alvherre(at)commandprompt(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-27 06:54:39
Message-ID: AANLkTimIVV6Kc8QYTm2D55hcrebMFV8q_zg53LWJs0kO@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

2010/5/27 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>> On Wed, May 26, 2010 at 8:21 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>> If we go with the spec's syntax I think we'd have no realistic choice
>>> except to forbid => altogether as an operator name.  (And no, I'm not
>>> for that.)
>
>> I suppose the most painful thing about doing that is that it would
>> break hstore.  Are there other commonly-used modules that rely on =>
>> as an operator name?
>
> There don't seem to be any other contrib modules that define => as an
> operator name, but I'm not sure what's out there on pgfoundry or
> elsewhere.  The bigger issue to me is not so much hstore itself as that
> this is an awfully attractive operator name for anything container-ish.
> Wasn't the JSON-datatype proposal using => for an operator at one stage?
> (The current wiki page for it doesn't seem to reflect any such idea,
> though.)  And I think I remember Oleg & Teodor proposing such an
> operator in conjunction with some GIN-related idea or other.
>
>> In spite of the difficulties, I'm reluctant to give up on it.  I
>> always thought that the "AS" syntax was a crock and I'm not eager to
>> invent another crock to replace it.  Being compatible with the SQL
>> standard and with Oracle is not to be taken lightly.
>
> Yeah, I know.  Though this could end up being one of the bits of the
> spec that we politely decline to follow, like upper-casing identifiers.
> Still, it's a good idea to think again before we've set the release
> in stone ...

we have a last minutes for decision. any other change will need years
- like 'standard strings'. I agree so it's not good time for change.
But this change is a few lines in parser.

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: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, alvherre <alvherre(at)commandprompt(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-27 06:55:34
Message-ID: AANLkTikhQDf0vngEtsh5gO1raIsw9ClcanajGMlT1YM8@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

2010/5/27 Robert Haas <robertmhaas(at)gmail(dot)com>:
> On Wed, May 26, 2010 at 9:28 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>>> On Wed, May 26, 2010 at 8:21 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>>> If we go with the spec's syntax I think we'd have no realistic choice
>>>> except to forbid => altogether as an operator name.  (And no, I'm not
>>>> for that.)
>>
>>> I suppose the most painful thing about doing that is that it would
>>> break hstore.  Are there other commonly-used modules that rely on =>
>>> as an operator name?
>>
>> There don't seem to be any other contrib modules that define => as an
>> operator name, but I'm not sure what's out there on pgfoundry or
>> elsewhere.  The bigger issue to me is not so much hstore itself as that
>> this is an awfully attractive operator name for anything container-ish.
>> Wasn't the JSON-datatype proposal using => for an operator at one stage?
>> (The current wiki page for it doesn't seem to reflect any such idea,
>> though.)  And I think I remember Oleg & Teodor proposing such an
>> operator in conjunction with some GIN-related idea or other.
>>
>>> In spite of the difficulties, I'm reluctant to give up on it.  I
>>> always thought that the "AS" syntax was a crock and I'm not eager to
>>> invent another crock to replace it.  Being compatible with the SQL
>>> standard and with Oracle is not to be taken lightly.
>>
>> Yeah, I know.  Though this could end up being one of the bits of the
>> spec that we politely decline to follow, like upper-casing identifiers.
>> Still, it's a good idea to think again before we've set the release
>> in stone ...
>
> Perhaps one idea would be to:
>
> 1. Invent a new crock for now.
> 2. Add a duplicate version of the hstore => operator with a different name.
> 3. Emit a warning whenever an operator called => is created.
> 4. Document that beginning in PG 9.1, we will no longer support => as
> an operator name.

+1

Pavel

>
> That's still going to cause a fair amount of pain, but certainly less
> if we decide it now rather than later.
>
> --
> Robert Haas
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise Postgres Company
>
> --
> 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: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: alvherre <alvherre(at)commandprompt(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-27 07:12:35
Message-ID: 4BFE1B63.3070708@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 27/05/10 09:50, Pavel Stehule wrote:
> 2010/5/27 Heikki Linnakangas<heikki(dot)linnakangas(at)enterprisedb(dot)com>:
>> AFAIU, the standard doesn't say anything about named parameters. Oracle uses
>> =>, but as you said, that's ambiguous with the => operator.
>>
>> +1 for FOR.
>
> I don't see any advantage of "FOR".

Any advantage over AS? It doesn't clash with the "foo AS bar" syntax
that the standard is using for something completely different, as Peter
pointed out in the original post.

> We can change ir to support new standard or don't change it.

What new standard?

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com


From: Abhijit Menon-Sen <ams(at)toroid(dot)org>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-27 07:15:56
Message-ID: 20100527071556.GA8846@toroid.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

At 2010-05-27 08:50:18 +0200, pavel(dot)stehule(at)gmail(dot)com wrote:
>
> I don't see any advantage of "FOR". We can change ir to support new
> standard or don't change it.

Adopting FOR would mean we don't use AS in a way that conflicts with the
standard. That's its only advantage. But I agree with you, I don't think
it's worth inventing a new non-standard wart for this case.

I don't really like the idea of getting rid of => as an operator either;
I'm torn between staying true to the standard and politely looking the
other way as Tom suggested we might end up doing.

-- ams


From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: alvherre <alvherre(at)commandprompt(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-27 07:16:19
Message-ID: AANLkTin3j9-fXv3TTG-B0bIlxcsYv2B8gOq-uy9Z-8fg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

2010/5/27 Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>:
> On 27/05/10 09:50, Pavel Stehule wrote:
>>
>> 2010/5/27 Heikki Linnakangas<heikki(dot)linnakangas(at)enterprisedb(dot)com>:
>>>
>>> AFAIU, the standard doesn't say anything about named parameters. Oracle
>>> uses
>>> =>, but as you said, that's ambiguous with the =>  operator.
>>>
>>> +1 for FOR.
>>
>> I don't see any advantage of "FOR".
>
> Any advantage over AS? It doesn't clash with the "foo AS bar" syntax that
> the standard is using for something completely different, as Peter pointed
> out in the original post.

No, standard knows "AS" in different context. In param list standard
doesn't use keyword "AS".

>
>> We can change ir to support new  standard or don't change it.
>
> What new standard?
>

ANSI SQL 2011

Pavel
> --
>  Heikki Linnakangas
>  EnterpriseDB   http://www.enterprisedb.com
>


From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Abhijit Menon-Sen <ams(at)toroid(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-27 07:17:21
Message-ID: AANLkTil7-bqlNkjfXenHyWAnhOwizT6G3EvRAmkzPCFC@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

2010/5/27 Abhijit Menon-Sen <ams(at)toroid(dot)org>:
> At 2010-05-27 08:50:18 +0200, pavel(dot)stehule(at)gmail(dot)com wrote:
>>
>> I don't see any advantage of "FOR". We can change ir to support new
>> standard or don't change it.
>
> Adopting FOR would mean we don't use AS in a way that conflicts with the
> standard. That's its only advantage. But I agree with you, I don't think
> it's worth inventing a new non-standard wart for this case.

current using "AS" isn't in conflict with standard .. look to standard, please.

Pavel

>
> I don't really like the idea of getting rid of => as an operator either;
> I'm torn between staying true to the standard and politely looking the
> other way as Tom suggested we might end up doing.
>
> -- ams
>


From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: alvherre <alvherre(at)commandprompt(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-27 07:40:31
Message-ID: 4BFE21EF.5010106@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 27/05/10 10:16, Pavel Stehule wrote:
> 2010/5/27 Heikki Linnakangas<heikki(dot)linnakangas(at)enterprisedb(dot)com>:
>> On 27/05/10 09:50, Pavel Stehule wrote:
>>>
>>> 2010/5/27 Heikki Linnakangas<heikki(dot)linnakangas(at)enterprisedb(dot)com>:
>>>>
>>>> AFAIU, the standard doesn't say anything about named parameters. Oracle
>>>> uses
>>>> =>, but as you said, that's ambiguous with the => operator.
>>>>
>>>> +1 for FOR.
>>>
>>> I don't see any advantage of "FOR".
>>
>> Any advantage over AS? It doesn't clash with the "foo AS bar" syntax that
>> the standard is using for something completely different, as Peter pointed
>> out in the original post.
>
> No, standard knows "AS" in different context. In param list standard
> doesn't use keyword "AS".

As Peter pointed out in the original post, according to the standard
"function(foo AS bar)" means something else than what we have now.
Please re-read the original post.

>>> We can change ir to support new standard or don't change it.
>>
>> What new standard?
>
> ANSI SQL 2011

Oh, does that have something to say about named parameters? Is the draft
publicly available somewhere?

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, alvherre <alvherre(at)commandprompt(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-27 07:49:35
Message-ID: 1274946575.6152.0.camel@fsopti579.F-Secure.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On tor, 2010-05-27 at 04:06 +0300, Heikki Linnakangas wrote:
> On 27/05/10 03:57, Robert Haas wrote:
> > Being compatible with the SQL
> > standard and with Oracle is not to be taken lightly.
>
> I seem to be alone believing that the SQL standard doesn't say anything
> about named function parameters. Can someone point me to the relevant
> section of the standard?

It will be in SQL:2011.


From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, alvherre <alvherre(at)commandprompt(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-27 07:51:35
Message-ID: 4BFE2487.8020207@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 27/05/10 10:49, Peter Eisentraut wrote:
> On tor, 2010-05-27 at 04:06 +0300, Heikki Linnakangas wrote:
>> On 27/05/10 03:57, Robert Haas wrote:
>>> Being compatible with the SQL
>>> standard and with Oracle is not to be taken lightly.
>>
>> I seem to be alone believing that the SQL standard doesn't say anything
>> about named function parameters. Can someone point me to the relevant
>> section of the standard?
>
> It will be in SQL:2011.

Does it mandate => ?

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, alvherre <alvherre(at)commandprompt(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-27 08:15:29
Message-ID: 1274948129.6152.3.camel@fsopti579.F-Secure.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On tor, 2010-05-27 at 10:51 +0300, Heikki Linnakangas wrote:
> On 27/05/10 10:49, Peter Eisentraut wrote:
> > On tor, 2010-05-27 at 04:06 +0300, Heikki Linnakangas wrote:
> >> On 27/05/10 03:57, Robert Haas wrote:
> >>> Being compatible with the SQL
> >>> standard and with Oracle is not to be taken lightly.
> >>
> >> I seem to be alone believing that the SQL standard doesn't say anything
> >> about named function parameters. Can someone point me to the relevant
> >> section of the standard?
> >
> > It will be in SQL:2011.
>
> Does it mandate => ?

<routine invocation> ::= <routine name> <SQL argument list>

<routine name> ::= [ <schema name> <period> ] <qualified identifier>

<SQL argument list> ::= <left paren> [ <SQL argument> [ { <comma> <SQL
argument> }... ] ] <right paren>

<SQL argument> ::= <value expression>
| <generalized expression>
| <target specification>
| <contextually typed value specification>
| <named argument specification>

<generalized expression> ::= <value expression> AS <path-resolved
user-defined type name>

<named argument specification> ::= <SQL parameter name> <named argument
assignment token> <named argument SQL argument>

<named argument SQL argument> ::= <value expression>
| <target specification>
| <contextually typed value specification>

<named argument assignment token> ::=
=>


From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-27 08:29:22
Message-ID: AANLkTik7a_EUpx15NU0N8tjuzdix6CpodX0dSxOSqRMH@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

2010/5/26 Peter Eisentraut <peter_e(at)gmx(dot)net>:
> It turns out that the SQL standard uses the function call notation
>
> foo(this AS that)
>
> for something else:
>
> <routine invocation> ::= <routine name> <SQL argument list>
>
> <routine name> ::= [ <schema name> <period> ] <qualified identifier>
>
> <SQL argument list> ::= <left paren> [ <SQL argument> [ { <comma> <SQL
> argument> }... ] ] <right paren>
>
> <SQL argument> ::= <value expression>
> | <generalized expression>
> | <target specification>
>
> <generalized expression> ::= <value expression> AS <path-resolved
> user-defined type name>
>
> In systems that have inheritance of composite types, this is used to
> specify which type the value is supposed to be interpreted as (for
> example, to treat the value as a supertype).
>

can it be used (in ANSI SQL semantic) as cast?

like SELECT foo(10.33 AS int)

> Seems kind of bad to overload this with something completely different.
> What should we do?
>
>

Is ANSI SQL consistent in this syntax? SQL/XML use "AS" in different meaning.

Regards
Pavel

>
> --
> 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: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-27 16:59:49
Message-ID: 3882.1274979589@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
> Peter Eisentraut wrote:
>> In systems that have inheritance of composite types, this is used to
>> specify which type the value is supposed to be interpreted as (for
>> example, to treat the value as a supertype).

Why don't they just use CAST() syntax for that, instead of adding this
unnecessary syntax wart?

If their complaint is that CAST() is too much typing, perhaps they
could adopt :: cast notation ;-)

> I think we should fix it now. Quick thought: maybe we could use FOR
> instead of AS: select myfunc(7 for a, 6 for b);

I'm afraid FOR doesn't work either; it'll create a conflict with the
spec-defined SUBSTRING(x FOR y) syntax.

regards, tom lane


From: "David E(dot) Wheeler" <david(at)kineticode(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-27 17:27:03
Message-ID: A44F8BB3-1CC7-4E3D-B25A-538C60662723@kineticode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On May 27, 2010, at 9:59 AM, Tom Lane wrote:

>> I think we should fix it now. Quick thought: maybe we could use FOR
>> instead of AS: select myfunc(7 for a, 6 for b);
>
> I'm afraid FOR doesn't work either; it'll create a conflict with the
> spec-defined SUBSTRING(x FOR y) syntax.

How about "ISPARAMVALUEFOR"? That shouldn't conflict with anything.

Best,

David


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: "David E(dot) Wheeler" <david(at)kineticode(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-27 18:55:54
Message-ID: AANLkTim2RN5tmLwh6wTWBj5bVA4JE9BtcWu0b4oZqzMv@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, May 27, 2010 at 1:27 PM, David E. Wheeler <david(at)kineticode(dot)com> wrote:
> On May 27, 2010, at 9:59 AM, Tom Lane wrote:
>
>>> I think we should fix it now.  Quick thought: maybe we could use FOR
>>> instead of AS: select myfunc(7 for a, 6 for b);
>>
>> I'm afraid FOR doesn't work either; it'll create a conflict with the
>> spec-defined SUBSTRING(x FOR y) syntax.
>
> How about "ISPARAMVALUEFOR"? That shouldn't conflict with anything.

Or we could use the Finnish word
epäjärjestelmällistyttämättömyydellänsäkäänköhän, which I'm pretty
sure is not currently used in our grammar.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company


From: "David E(dot) Wheeler" <david(at)kineticode(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-27 18:59:34
Message-ID: 81CA1D95-2199-4358-909F-576527BE9B31@kineticode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On May 27, 2010, at 11:55 AM, Robert Haas wrote:

> Or we could use the Finnish word
> epäjärjestelmällistyttämättömyydellänsäkäänköhän, which I'm pretty
> sure is not currently used in our grammar.

I thought that was an Icelandic volcano.

Best,

David


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: "David E(dot) Wheeler" <david(at)kineticode(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-27 19:01:39
Message-ID: AANLkTilL96CB1ZBf5P5Pmq4xXmEE_oc2bvORXn-rQ_un@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, May 27, 2010 at 2:59 PM, David E. Wheeler <david(at)kineticode(dot)com> wrote:
> On May 27, 2010, at 11:55 AM, Robert Haas wrote:
>> Or we could use the Finnish word
>> epäjärjestelmällistyttämättömyydellänsäkäänköhän, which I'm pretty
>> sure is not currently used in our grammar.
>
> I thought that was an Icelandic volcano.

No, that's Eyjafjallajökull.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-27 19:37:52
Message-ID: 1274989072.18581.37.camel@vanquo.pezone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On tor, 2010-05-27 at 12:59 -0400, Tom Lane wrote:
> > I think we should fix it now. Quick thought: maybe we could use
> FOR
> > instead of AS: select myfunc(7 for a, 6 for b);
>
> I'm afraid FOR doesn't work either; it'll create a conflict with the
> spec-defined SUBSTRING(x FOR y) syntax.

How about

select myfunc(a := 7, b := 6);

?


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-27 19:55:14
Message-ID: 6941.1274990114@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> On tor, 2010-05-27 at 12:59 -0400, Tom Lane wrote:
>> I'm afraid FOR doesn't work either; it'll create a conflict with the
>> spec-defined SUBSTRING(x FOR y) syntax.

> How about
> select myfunc(a := 7, b := 6);
> ?

Hey, that's a thought. We couldn't have used that notation before
because we didn't have := as a separate token, but since I hacked that
in for plpgsql's benefit, I think it might be an easy fix. It'd be
nice that it puts the argument name first like the spec syntax, too.

Question #1: is the SQL committee likely to standardize that out
from under us, too?

Question #2: will ecpg have a problem with this? Or psql for that
matter (can you have a psql variable named '=')?

regards, tom lane


From: Stephen Frost <sfrost(at)snowman(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-27 19:59:55
Message-ID: 20100527195955.GM21875@tamriel.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

* Tom Lane (tgl(at)sss(dot)pgh(dot)pa(dot)us) wrote:
> Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> > select myfunc(a := 7, b := 6);

Kinda like it myself.

> Question #1: is the SQL committee likely to standardize that out
> from under us, too?

Couldn't say on that one.

> Question #2: will ecpg have a problem with this? Or psql for that
> matter (can you have a psql variable named '=')?

psql doesn't like it, for what it's worth:

postgres=# \set = hi
\set: error

Thanks,

Stephen


From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-27 20:02:13
Message-ID: AANLkTikH8THYTt-y2PX2aPRLSqa-yPJzne2sN-s7EPQf@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

2010/5/27 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
> Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
>> On tor, 2010-05-27 at 12:59 -0400, Tom Lane wrote:
>>> I'm afraid FOR doesn't work either; it'll create a conflict with the
>>> spec-defined SUBSTRING(x FOR y) syntax.
>
>> How about
>> select myfunc(a := 7, b := 6);
>> ?
>
> Hey, that's a thought.  We couldn't have used that notation before
> because we didn't have := as a separate token, but since I hacked that
> in for plpgsql's benefit, I think it might be an easy fix.  It'd be
> nice that it puts the argument name first like the spec syntax, too.

I can live with it.

Regards

Pavel

>
> Question #1: is the SQL committee likely to standardize that out
> from under us, too?
>
> Question #2: will ecpg have a problem with this?  Or psql for that
> matter (can you have a psql variable named '=')?
>
>                        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: David Fetter <david(at)fetter(dot)org>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: "David E(dot) Wheeler" <david(at)kineticode(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-27 22:03:52
Message-ID: 20100527220352.GC3508@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, May 27, 2010 at 02:55:54PM -0400, Robert Haas wrote:
> On Thu, May 27, 2010 at 1:27 PM, David E. Wheeler <david(at)kineticode(dot)com> wrote:
> > On May 27, 2010, at 9:59 AM, Tom Lane wrote:
> >
> >>> I think we should fix it now.  Quick thought: maybe we could use FOR
> >>> instead of AS: select myfunc(7 for a, 6 for b);
> >>
> >> I'm afraid FOR doesn't work either; it'll create a conflict with the
> >> spec-defined SUBSTRING(x FOR y) syntax.
> >
> > How about "ISPARAMVALUEFOR"? That shouldn't conflict with anything.
>
> Or we could use the Finnish word
> epäjärjestelmällistyttämättömyydellänsäkäänköhän, which I'm pretty
> sure is not currently used in our grammar.

We could use the Turkish
muvaffakiyetsizleştiricileştiriveremeyebileceklerimizdenmişsinizcesine,
which I'm pretty sure isn't either :)

Cheers,
David.
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-28 03:32:22
Message-ID: 201005280332.o4S3WMF25017@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Peter Eisentraut wrote:
> On tor, 2010-05-27 at 12:59 -0400, Tom Lane wrote:
> > > I think we should fix it now. Quick thought: maybe we could use
> > FOR
> > > instead of AS: select myfunc(7 for a, 6 for b);
> >
> > I'm afraid FOR doesn't work either; it'll create a conflict with the
> > spec-defined SUBSTRING(x FOR y) syntax.
>
> How about
>
> select myfunc(a := 7, b := 6);

One concern I have is that in PL/pgSQL, := and = behave the same, while
in SQL, they would not. That might cause confusion.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-28 03:52:44
Message-ID: 4BFF3E0C.9080904@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Bruce Momjian wrote:
> Peter Eisentraut wrote:
>
>> On tor, 2010-05-27 at 12:59 -0400, Tom Lane wrote:
>>
>>>> I think we should fix it now. Quick thought: maybe we could use
>>>>
>>> FOR
>>>
>>>> instead of AS: select myfunc(7 for a, 6 for b);
>>>>
>>> I'm afraid FOR doesn't work either; it'll create a conflict with the
>>> spec-defined SUBSTRING(x FOR y) syntax.
>>>
>> How about
>>
>> select myfunc(a := 7, b := 6);
>>
>
> One concern I have is that in PL/pgSQL, := and = behave the same, while
> in SQL, they would not. That might cause confusion.
>
>

That is a sad wart that we should never have done, IMNSHO (it was before
my time or I would have objected ;-) ). But beyond that, = is an
operator in SQL and := is never an operator, IIRC.

cheers

andrew

I doubt there will be much confusion.


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-28 04:06:03
Message-ID: 17783.1275019563@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
> Bruce Momjian wrote:
>> One concern I have is that in PL/pgSQL, := and = behave the same, while
>> in SQL, they would not. That might cause confusion.

> I doubt there will be much confusion.

I agree. Bruce is ignoring the fact that they are *not* interchangeable
even in plpgsql, except in the one context of the assignment operator.
If you try to use := in a SQL construct it won't work, eg
if (a := b) then ...
if (a = b) then ...
have never been equivalent.

regards, tom lane


From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-28 06:42:40
Message-ID: 4BFF65E0.2090709@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 27/05/10 22:55, Tom Lane wrote:
> Peter Eisentraut<peter_e(at)gmx(dot)net> writes:
>> How about
>> select myfunc(a := 7, b := 6);
>> ?
>
> Hey, that's a thought. We couldn't have used that notation before
> because we didn't have := as a separate token, but since I hacked that
> in for plpgsql's benefit, I think it might be an easy fix. It'd be
> nice that it puts the argument name first like the spec syntax, too.

If we go with that, should we make some preparations to allow => in the
future? Like provide an alternative operator name for hstore's =>, and
add a note somewhere in the docs to discourage other modules from using =>.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-28 13:26:56
Message-ID: 24090.1275053216@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com> writes:
>> Peter Eisentraut<peter_e(at)gmx(dot)net> writes:
>>> How about
>>> select myfunc(a := 7, b := 6);

> If we go with that, should we make some preparations to allow => in the
> future? Like provide an alternative operator name for hstore's =>, and
> add a note somewhere in the docs to discourage other modules from using =>.

I'd vote no. We're intentionally choosing to deviate from a very poor
choice of notation. Maybe Peter can interest the committee in allowing
:= as an alternate notation, instead.

regards, tom lane


From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-28 14:08:47
Message-ID: AANLkTin9lIrOnxOrOH-rzSYvImgMRAs5kVEQwStD43pk@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

2010/5/28 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
> Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com> writes:
>>> Peter Eisentraut<peter_e(at)gmx(dot)net>  writes:
>>>> How about
>>>> select myfunc(a := 7, b := 6);
>
>> If we go with that, should we make some preparations to allow => in the
>> future? Like provide an alternative operator name for hstore's =>, and
>> add a note somewhere in the docs to discourage other modules from using =>.
>
> I'd vote no.  We're intentionally choosing to deviate from a very poor
> choice of notation.  Maybe Peter can interest the committee in allowing
> := as an alternate notation, instead.

-1

I prefer a standard. And again - it isn't poor syntax - ADA, Perl use
it, It can be a funny if ANSI SQL committee change some design from
Oracle's proposal to PostgreSQL's proposal.

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: 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>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-28 14:26:52
Message-ID: 4BFFD2AC.7080502@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Tom Lane wrote:
> Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com> writes:
>
>>> Peter Eisentraut<peter_e(at)gmx(dot)net> writes:
>>>
>>>> How about
>>>> select myfunc(a := 7, b := 6);
>>>>
>
>
>> If we go with that, should we make some preparations to allow => in the
>> future? Like provide an alternative operator name for hstore's =>, and
>> add a note somewhere in the docs to discourage other modules from using =>.
>>
>
> I'd vote no. We're intentionally choosing to deviate from a very poor
> choice of notation. Maybe Peter can interest the committee in allowing
> := as an alternate notation, instead.
>
>
>

What's poor about it? It probably comes from PLSQL which in turn got it
from Ada, so they aren't just making this up. I agree it's inconvenient
for us, but that's a different issue.

cheers

andrew


From: Josh Berkus <josh(at)agliodbs(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-28 16:19:38
Message-ID: 4BFFED1A.40400@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


> What's poor about it? It probably comes from PLSQL which in turn got it
> from Ada, so they aren't just making this up. I agree it's inconvenient
> for us, but that's a different issue.

Further, the
( parameter := value ) notation is not only consistent with what is used
inside pl/pgsql, it's also more consistent than "AS" with SQL Server's
named parameter notation, which is:

EXEC dbo.GetItemPrice @ItemCode = 'GXKP', @PriceLevel = 5

Since former SQL Server / Sybase apps are the most likely to use named
parameter notation in PostgreSQL, having a syntax which could be ported
using only "sed" would be nice.

Relevant to the whole discussion, though ... is the conflicting SQL
standard syntax something we're every likely to implement?

--
-- Josh Berkus
PostgreSQL Experts Inc.
http://www.pgexperts.com


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-28 16:39:47
Message-ID: 201005281639.o4SGdlC28029@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Josh Berkus wrote:
> Since former SQL Server / Sybase apps are the most likely to use named
> parameter notation in PostgreSQL, having a syntax which could be ported
> using only "sed" would be nice.
>
> Relevant to the whole discussion, though ... is the conflicting SQL
> standard syntax something we're every likely to implement?

Not sure, but I assume people could be using the AS syntax in other
databases (for the inheritance usage) and then trying to use it in our
database.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Josh Berkus <josh(at)agliodbs(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-28 16:45:44
Message-ID: 4BFFF338.9090902@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Bruce Momjian wrote:
> Josh Berkus wrote:
>
>> Since former SQL Server / Sybase apps are the most likely to use named
>> parameter notation in PostgreSQL, having a syntax which could be ported
>> using only "sed" would be nice.
>>
>> Relevant to the whole discussion, though ... is the conflicting SQL
>> standard syntax something we're every likely to implement?
>>
>
> Not sure, but I assume people could be using the AS syntax in other
> databases (for the inheritance usage) and then trying to use it in our
> database.
>
>

Yeah. Whether or not we ever implement it really doesn't matter, IMO. We
should not be in the business of taking an SQL standard piece of syntax
and using it for some other purpose.

cheers

andrew


From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-28 17:25:57
Message-ID: 4BFFFCA5.7060008@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 28/05/10 19:19, Josh Berkus wrote:
> ( parameter := value ) notation is not only consistent with what is used
> inside pl/pgsql, it's also more consistent than "AS" with SQL Server's
> named parameter notation, which is:
>
> EXEC dbo.GetItemPrice @ItemCode = 'GXKP', @PriceLevel = 5
>
> Since former SQL Server / Sybase apps are the most likely to use named
> parameter notation in PostgreSQL, having a syntax which could be ported
> using only "sed" would be nice.

Once you solve the problem of finding the '='s in the source, replacing
them is exactly the same effort regardless of what you replace them with.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, Josh Berkus <josh(at)agliodbs(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-28 18:33:49
Message-ID: 4017.1275071629@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
> Yeah. Whether or not we ever implement it really doesn't matter, IMO. We
> should not be in the business of taking an SQL standard piece of syntax
> and using it for some other purpose.

Evidently the 201x SQL standard has blindsided us twice: first by
defining a syntax for named parameters that wasn't like ours, and second
by defining a syntax for something else that conflicted with ours.
I agree that the AS approach is pretty untenable given that double
whammy, and we'd better get rid of it. (Hopefully Peter will be able
to keep us better apprised of things in the future.)

It seems that we're agreed on trying to use := instead, and the only
debate is about whether to deprecate use of => as an operator. But
anything that we might do about the latter would reach no farther than
the documentation in 9.0 anyway.

regards, tom lane


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-28 18:36:02
Message-ID: 4054.1275071762@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Josh Berkus <josh(at)agliodbs(dot)com> writes:
> Since former SQL Server / Sybase apps are the most likely to use named
> parameter notation in PostgreSQL, having a syntax which could be ported
> using only "sed" would be nice.

I fear you're vastly overestimating the ability of sed to distinguish
between = used in this way and = used in any other way. Still, putting
the parameter name on the left is clearly both more natural and more
like every other product.

regards, tom lane


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-28 19:06:20
Message-ID: AANLkTinNFTzErwi82vvPV95Nzv2M-wu-u2jRKEYtj9a5@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Fri, May 28, 2010 at 10:08 AM, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:
> 2010/5/28 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
>> Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com> writes:
>>>> Peter Eisentraut<peter_e(at)gmx(dot)net>  writes:
>>>>> How about
>>>>> select myfunc(a := 7, b := 6);
>>
>>> If we go with that, should we make some preparations to allow => in the
>>> future? Like provide an alternative operator name for hstore's =>, and
>>> add a note somewhere in the docs to discourage other modules from using =>.
>>
>> I'd vote no.  We're intentionally choosing to deviate from a very poor
>> choice of notation.  Maybe Peter can interest the committee in allowing
>> := as an alternate notation, instead.
>
> -1
>
> I prefer a standard. And again - it isn't poor syntax - ADA, Perl use
> it, It can be a funny if ANSI SQL committee change some design from
> Oracle's proposal to PostgreSQL's proposal.

I agree. It's good syntax. I think we should try hard to adopt it.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company


From: Dimitri Fontaine <dfontaine(at)hi-media(dot)com>
To: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: Josh Berkus <josh(at)agliodbs(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-28 19:38:56
Message-ID: m24ohrn7e7.fsf@hi-media.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com> writes:
> On 28/05/10 19:19, Josh Berkus wrote:
>> EXEC dbo.GetItemPrice @ItemCode = 'GXKP', @PriceLevel = 5
>
> Once you solve the problem of finding the '='s in the source, replacing them
> is exactly the same effort regardless of what you replace them with.

I guess it would be a choice of target between
'GXKP' AS ItemCode, 5 AS PriceLevel
and
ItemCode := 'GXKP', PriceLevel := 5

By the way, as it seems we're voting, I much prefer := than either the
AS and => variant, and I'm not keen on seeing us deprecate the operator.

Further, as said Andrew, keeping AS conflicting with the standard with
no hysterical raisin to do so would be a bad move IMHO.

Regards,
--
dim


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-30 14:50:19
Message-ID: 5798.1275231019@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

So as far as I can tell, no one is opposed to replacing "expr AS name"
with "name := expr" in the named-parameter syntax. Obviously we had
better get this done before beta2. Is anyone actually working on the
code/docs changes? If not, I'll pick it up.

regards, tom lane


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-31 14:16:26
Message-ID: 201005311416.o4VEGQh11594@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Tom Lane wrote:
> So as far as I can tell, no one is opposed to replacing "expr AS name"
> with "name := expr" in the named-parameter syntax. Obviously we had
> better get this done before beta2. Is anyone actually working on the
> code/docs changes? If not, I'll pick it up.

If we eventually are going to want to support the ANSI standard "=>"
syntax, I am thinking we should just do it now. The larger question is
what justification do we have of not supporting "=>".

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com


From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-31 14:26:00
Message-ID: AANLkTin-nD9lXTeCLJNBgAJvRXHWkU3dBUd5LrFKJ35z@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

2010/5/31 Bruce Momjian <bruce(at)momjian(dot)us>:
> Tom Lane wrote:
>> So as far as I can tell, no one is opposed to replacing "expr AS name"
>> with "name := expr" in the named-parameter syntax.  Obviously we had
>> better get this done before beta2.  Is anyone actually working on the
>> code/docs changes?  If not, I'll pick it up.
>
> If we eventually are going to want to support the ANSI standard "=>"
> syntax, I am thinking we should just do it now.  The larger question is
> what justification do we have of not supporting "=>".

I am for ANSI stanadard. I afraid so we can do nothing now. First we
have to implement substitution of "=>" operator in hstore module.
Second we have to mark this operator as deprecated. Maybe we can do it
in 9.1 with integration of hstore to core. I would to see any hash
table support in core. It can be significant help for PLpgSQL coders.
What more - it can work nice with proposed JSON support.

Regards
Pavel
>
> --
>  Bruce Momjian  <bruce(at)momjian(dot)us>        http://momjian.us
>  EnterpriseDB                             http://enterprisedb.com
>
> --
> 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: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-31 14:59:15
Message-ID: 12885.1275317955@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Bruce Momjian <bruce(at)momjian(dot)us> writes:
> Tom Lane wrote:
>> So as far as I can tell, no one is opposed to replacing "expr AS name"
>> with "name := expr" in the named-parameter syntax. Obviously we had
>> better get this done before beta2. Is anyone actually working on the
>> code/docs changes? If not, I'll pick it up.

> If we eventually are going to want to support the ANSI standard "=>"
> syntax, I am thinking we should just do it now. The larger question is
> what justification do we have of not supporting "=>".

Not breaking hstore, as well as any third-party modules that might be
using that operator name. Did you not absorb any of the discussion
so far?

regards, tom lane


From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-31 15:07:15
Message-ID: AANLkTilMyzZE71JhZXHqPGiygypleSLjFOUHX70ncIlS@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

2010/5/31 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
> Bruce Momjian <bruce(at)momjian(dot)us> writes:
>> Tom Lane wrote:
>>> So as far as I can tell, no one is opposed to replacing "expr AS name"
>>> with "name := expr" in the named-parameter syntax.  Obviously we had
>>> better get this done before beta2.  Is anyone actually working on the
>>> code/docs changes?  If not, I'll pick it up.
>
>> If we eventually are going to want to support the ANSI standard "=>"
>> syntax, I am thinking we should just do it now.  The larger question is
>> what justification do we have of not supporting "=>".
>
> Not breaking hstore, as well as any third-party modules that might be
> using that operator name.  Did you not absorb any of the discussion
> so far?
>

can we search thise applications? I know only about hstore module. We
can ask people who use it in own applications. But every major version
of PostgreSQL can breaks compatibility - like 9.0 with variable names
in plpgsql.

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: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-31 15:22:08
Message-ID: 201005311522.o4VFM8Z01718@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Tom Lane wrote:
> Bruce Momjian <bruce(at)momjian(dot)us> writes:
> > Tom Lane wrote:
> >> So as far as I can tell, no one is opposed to replacing "expr AS name"
> >> with "name := expr" in the named-parameter syntax. Obviously we had
> >> better get this done before beta2. Is anyone actually working on the
> >> code/docs changes? If not, I'll pick it up.
>
> > If we eventually are going to want to support the ANSI standard "=>"
> > syntax, I am thinking we should just do it now. The larger question is
> > what justification do we have of not supporting "=>".
>
> Not breaking hstore, as well as any third-party modules that might be
> using that operator name. Did you not absorb any of the discussion
> so far?

Yes, but if we are going to have to honor "=>" eventually, shouldn't we
just do it now? Supporting := and => seems confusing.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-31 15:24:44
Message-ID: 13367.1275319484@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Bruce Momjian <bruce(at)momjian(dot)us> writes:
> Yes, but if we are going to have to honor "=>" eventually, shouldn't we
> just do it now? Supporting := and => seems confusing.

Personally, I haven't accepted the "if" part of that, therefore I
feel no need to argue over the "then".

regards, tom lane


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-31 15:29:40
Message-ID: 201005311529.o4VFTep02459@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Tom Lane wrote:
> Bruce Momjian <bruce(at)momjian(dot)us> writes:
> > Yes, but if we are going to have to honor "=>" eventually, shouldn't we
> > just do it now? Supporting := and => seems confusing.
>
> Personally, I haven't accepted the "if" part of that, therefore I
> feel no need to argue over the "then".

Right, I am asking about the "if" part.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com


From: Greg Stark <gsstark(at)mit(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-31 15:41:40
Message-ID: AANLkTikTiyDOyPezCqEdCC1RJFdQ6PbFdHBz4sqMLP4-@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Mon, May 31, 2010 at 3:59 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Not breaking hstore, as well as any third-party modules that might be
> using that operator name.  Did you not absorb any of the discussion
> so far?
>

In fairness most of the discussion about breaking hstore was prior to
our learning that the sql committee had gone so far into the weeds.

If => is sql standard syntax then perhaps that changes the calculus.
It's no longer a matter of supporting some oracle-specific syntax that
diverges from sqlish syntax and conflicts with our syntax. Instead
it's a question of our operator syntax conflicting with the sql
standard.

Part of the earlier discussion was about how => was a tempting
operator name and other users may well have chosen it precisely
because it's so evocative. But we don't actually have any evidence of
that. Does anyone have any experience seeing => operators in the wild?

--
greg


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Greg Stark <gsstark(at)mit(dot)edu>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-31 15:47:26
Message-ID: 201005311547.o4VFlQB04442@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Greg Stark wrote:
> On Mon, May 31, 2010 at 3:59 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> > Not breaking hstore, as well as any third-party modules that might be
> > using that operator name. ?Did you not absorb any of the discussion
> > so far?
> >
>
> In fairness most of the discussion about breaking hstore was prior to
> our learning that the sql committee had gone so far into the weeds.
>
> If => is sql standard syntax then perhaps that changes the calculus.
> It's no longer a matter of supporting some oracle-specific syntax that
> diverges from sqlish syntax and conflicts with our syntax. Instead
> it's a question of our operator syntax conflicting with the sql
> standard.
>
> Part of the earlier discussion was about how => was a tempting
> operator name and other users may well have chosen it precisely
> because it's so evocative. But we don't actually have any evidence of
> that. Does anyone have any experience seeing => operators in the wild?

Tangentially, I think the SQL committee chose => because the value, then
variable, ordering is so unintuitive, and I think they wanted that
ordering because most function calls use values so they wanted the
variable at the end.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Greg Stark <gsstark(at)mit(dot)edu>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-31 15:52:07
Message-ID: 13884.1275321127@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Greg Stark <gsstark(at)mit(dot)edu> writes:
> If => is sql standard syntax then perhaps that changes the calculus.

Well, it *isn't* standard, yet at least. All we have is a report of the
current wording of a draft that's at least a year from release.

regards, tom lane


From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Greg Stark <gsstark(at)mit(dot)edu>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-31 15:55:15
Message-ID: AANLkTik_-SOmubaR04wvD2o9XNHZ77f-_0uRMTIayhgY@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

2010/5/31 Bruce Momjian <bruce(at)momjian(dot)us>:
> Greg Stark wrote:
>> On Mon, May 31, 2010 at 3:59 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> > Not breaking hstore, as well as any third-party modules that might be
>> > using that operator name. ?Did you not absorb any of the discussion
>> > so far?
>> >
>>
>> In fairness most of the discussion about breaking hstore was prior to
>> our learning that the sql committee had gone so far into the weeds.
>>
>> If => is sql standard syntax then perhaps that changes the calculus.
>> It's no longer a matter of supporting some oracle-specific syntax that
>> diverges from sqlish syntax and conflicts with our syntax. Instead
>> it's a question of our operator syntax conflicting with the sql
>> standard.
>>
>> Part of the earlier discussion was about how => was a tempting
>> operator name and other users may well have chosen it precisely
>> because it's so evocative. But we don't actually have any evidence of
>> that. Does anyone have any experience seeing => operators in the wild?
>
> Tangentially, I think the SQL committee chose => because the value, then
> variable, ordering is so unintuitive, and I think they wanted that
> ordering because most function calls use values so they wanted the
> variable at the end.

maybe, maybe not. Maybe just adopt Oracle's syntax - nothing more,
nothing less - like like some others.

Regards
Pavel
>
> --
>  Bruce Momjian  <bruce(at)momjian(dot)us>        http://momjian.us
>  EnterpriseDB                             http://enterprisedb.com
>
> --
> 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: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-31 15:56:33
Message-ID: 4C03DC31.2090908@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Tom Lane wrote:
> Bruce Momjian <bruce(at)momjian(dot)us> writes:
>
>> Yes, but if we are going to have to honor "=>" eventually, shouldn't we
>> just do it now? Supporting := and => seems confusing.
>>
>
> Personally, I haven't accepted the "if" part of that, therefore I
> feel no need to argue over the "then".
>
>
>

OK, but if that's going to influence the decision, let's debate it.

I think we should aim to comply with the spec, and incidentally be
compatible with Oracle too. => is used by a number of other languages,
for this or a similar purpose, so it would feel a bit more intuitive
and familiar to some people.

I don't have strong feelings about the timing - I'd be very surprised if
:= were to be used in this context for any other purpose, so I don't
think we'd be biting ourselves too much by just using that now. But if
we do that, we should deprecate use of => as an operator now, and
definitely remove its use in hstore either now or in 9.1.

cheers

andrew


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: Greg Stark <gsstark(at)mit(dot)edu>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-31 15:57:08
Message-ID: 201005311557.o4VFv8V05778@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Pavel Stehule wrote:
> >> Part of the earlier discussion was about how => was a tempting
> >> operator name and other users may well have chosen it precisely
> >> because it's so evocative. But we don't actually have any evidence of
> >> that. Does anyone have any experience seeing => operators in the wild?
> >
> > Tangentially, I think the SQL committee chose => because the value, then
> > variable, ordering is so unintuitive, and I think they wanted that
> > ordering because most function calls use values so they wanted the
> > variable at the end.
>
> maybe, maybe not. Maybe just adopt Oracle's syntax - nothing more,
> nothing less - like like some others.

Yea, definitely they were copying Oracle. My point is that the odd
ordering does make sense, and the use of an arrow-like operator also
makes sense because of the odd ordering.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ None of us is going to be here forever. +


From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Greg Stark <gsstark(at)mit(dot)edu>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-31 16:03:40
Message-ID: AANLkTike2WAWV-Gl_7RK8tCwgEdWxjwrfDAyQ_goOspc@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

2010/5/31 Bruce Momjian <bruce(at)momjian(dot)us>:
> Pavel Stehule wrote:
>> >> Part of the earlier discussion was about how => was a tempting
>> >> operator name and other users may well have chosen it precisely
>> >> because it's so evocative. But we don't actually have any evidence of
>> >> that. Does anyone have any experience seeing => operators in the wild?
>> >
>> > Tangentially, I think the SQL committee chose => because the value, then
>> > variable, ordering is so unintuitive, and I think they wanted that
>> > ordering because most function calls use values so they wanted the
>> > variable at the end.
>>
>> maybe, maybe not. Maybe just adopt Oracle's syntax - nothing more,
>> nothing less - like like some others.
>
> Yea, definitely they were copying Oracle.  My point is that the odd
> ordering does make sense, and the use of an arrow-like operator also
> makes sense because of the odd ordering.
>

What I know - this feature is supported only by Oracle and MSSQL now.
MSSQL syntax isn't available, because expected @ before variables. So
there is available only Oracle's syntax. It is some like industrial
standard.

Pavel

> --
>  Bruce Momjian  <bruce(at)momjian(dot)us>        http://momjian.us
>  EnterpriseDB                             http://enterprisedb.com
>
>  + None of us is going to be here forever. +
>
>


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: Greg Stark <gsstark(at)mit(dot)edu>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-31 16:14:12
Message-ID: 201005311614.o4VGECG09851@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Pavel Stehule wrote:
> 2010/5/31 Bruce Momjian <bruce(at)momjian(dot)us>:
> > Pavel Stehule wrote:
> >> >> Part of the earlier discussion was about how => was a tempting
> >> >> operator name and other users may well have chosen it precisely
> >> >> because it's so evocative. But we don't actually have any evidence of
> >> >> that. Does anyone have any experience seeing => operators in the wild?
> >> >
> >> > Tangentially, I think the SQL committee chose => because the value, then
> >> > variable, ordering is so unintuitive, and I think they wanted that
> >> > ordering because most function calls use values so they wanted the
> >> > variable at the end.
> >>
> >> maybe, maybe not. Maybe just adopt Oracle's syntax - nothing more,
> >> nothing less - like like some others.
> >
> > Yea, definitely they were copying Oracle. ?My point is that the odd
> > ordering does make sense, and the use of an arrow-like operator also
> > makes sense because of the odd ordering.
> >
>
> What I know - this feature is supported only by Oracle and MSSQL now.
> MSSQL syntax isn't available, because expected @ before variables. So
> there is available only Oracle's syntax. It is some like industrial
> standard.

MSSQL? Are you sure? This is the example posted in this thread:

EXEC dbo.GetItemPrice @ItemCode = 'GXKP', @PriceLevel = 5

and it more matches our := syntax than => in its argument ordering.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ None of us is going to be here forever. +


From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Greg Stark <gsstark(at)mit(dot)edu>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-31 16:23:03
Message-ID: AANLkTim9jubqqG8kepdEhhM0xNnLNhduZb2GtCIHiukr@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

2010/5/31 Bruce Momjian <bruce(at)momjian(dot)us>:
> Pavel Stehule wrote:
>> 2010/5/31 Bruce Momjian <bruce(at)momjian(dot)us>:
>> > Pavel Stehule wrote:
>> >> >> Part of the earlier discussion was about how => was a tempting
>> >> >> operator name and other users may well have chosen it precisely
>> >> >> because it's so evocative. But we don't actually have any evidence of
>> >> >> that. Does anyone have any experience seeing => operators in the wild?
>> >> >
>> >> > Tangentially, I think the SQL committee chose => because the value, then
>> >> > variable, ordering is so unintuitive, and I think they wanted that
>> >> > ordering because most function calls use values so they wanted the
>> >> > variable at the end.
>> >>
>> >> maybe, maybe not. Maybe just adopt Oracle's syntax - nothing more,
>> >> nothing less - like like some others.
>> >
>> > Yea, definitely they were copying Oracle. ?My point is that the odd
>> > ordering does make sense, and the use of an arrow-like operator also
>> > makes sense because of the odd ordering.
>> >
>>
>> What I know - this feature is supported only by Oracle and MSSQL now.
>> MSSQL syntax isn't available, because expected @ before variables. So
>> there is available only Oracle's syntax. It is some like industrial
>> standard.
>
> MSSQL?  Are you sure?  This is the example posted in this thread:
>
>        EXEC dbo.GetItemPrice @ItemCode = 'GXKP', @PriceLevel = 5
>
> and it more matches our := syntax than => in its argument ordering.

it's not important in this discussion. Important is using some usual
symbol '=' or special symbol '=>'. Our syntax is probably only one
possible solution in this moment (there are minimum controversy), bud
semantic isn't best. Using same operator as assign statement uses can
be messy. I don't know what is a true - you have to ask of ADA
designers.

Regards
Pavel

>
> --
>  Bruce Momjian  <bruce(at)momjian(dot)us>        http://momjian.us
>  EnterpriseDB                             http://enterprisedb.com
>
>  + None of us is going to be here forever. +
>
>


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Greg Stark <gsstark(at)mit(dot)edu>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-31 16:26:08
Message-ID: 4C03E320.1000305@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Bruce Momjian wrote:
> MSSQL? Are you sure? This is the example posted in this thread:
>
> EXEC dbo.GetItemPrice @ItemCode = 'GXKP', @PriceLevel = 5
>
> and it more matches our := syntax than => in its argument ordering.
>

I think you are seriously confused, or else you are seriously confusing
me. The => proposal is to have the ordering "param_name =>
passed_value", just as Oracle has, just as MSSQL has "@param_name =
passed_value", and just as the := proposal would have "param_name :=
passed_value".

cheers

andrew


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Greg Stark <gsstark(at)mit(dot)edu>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-31 16:35:32
Message-ID: 201005311635.o4VGZW112075@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Andrew Dunstan wrote:
>
>
> Bruce Momjian wrote:
> > MSSQL? Are you sure? This is the example posted in this thread:
> >
> > EXEC dbo.GetItemPrice @ItemCode = 'GXKP', @PriceLevel = 5
> >
> > and it more matches our := syntax than => in its argument ordering.
> >
>
> I think you are seriously confused, or else you are seriously confusing
> me. The => proposal is to have the ordering "param_name =>
> passed_value", just as Oracle has, just as MSSQL has "@param_name =
> passed_value", and just as the := proposal would have "param_name :=
> passed_value".

You are right; I am seriously confused. I thought it was value =>
variable. I was wrong.

I now see the Oracle syntax matches the Perl hash assignment syntax.

The "=>" operator is helpful in documenting the
correspondence between keys and values in hashes, and
other paired elements in lists.

%hash = ( $key => $value );
login( $username => $password );

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ None of us is going to be here forever. +


From: Dimitri Fontaine <dfontaine(at)hi-media(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, Greg Stark <gsstark(at)mit(dot)edu>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-31 19:06:38
Message-ID: m2zkzfvqkh.fsf@hi-media.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> writes:
> it's not important in this discussion. Important is using some usual
> symbol '=' or special symbol '=>'. Our syntax is probably only one
> possible solution in this moment (there are minimum controversy), bud
> semantic isn't best. Using same operator as assign statement uses can
> be messy. I don't know what is a true - you have to ask of ADA
> designers.

Well you assign a value to a named parameter, so I don't see the point.

Now SELECT myfunc(a := 1, b => 2); is about fine, the only point is that
the => operator looks good for associative things such as hstore, so
chances that it has been used are not so low.

I guess we could choose to go with := for 9.1 and revisit the =>
situation after the SQL standard has settled on the new version. Maybe
this move would even have some impact now that we have a voice over
there.

Regards,
--
dim


From: "David E(dot) Wheeler" <david(at)kineticode(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Bruce Momjian <bruce(at)momjian(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-31 22:16:30
Message-ID: 17555B4B-C6CB-403E-86D3-7EBC2E1CA119@kineticode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On May 31, 2010, at 8:56 AM, Andrew Dunstan wrote:

> I don't have strong feelings about the timing - I'd be very surprised if := were to be used in this context for any other purpose, so I don't think we'd be biting ourselves too much by just using that now. But if we do that, we should deprecate use of => as an operator now, and definitely remove its use in hstore either now or in 9.1.

+1

David


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "David E(dot) Wheeler" <david(at)kineticode(dot)com>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, Bruce Momjian <bruce(at)momjian(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-05-31 22:23:04
Message-ID: 20894.1275344584@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

"David E. Wheeler" <david(at)kineticode(dot)com> writes:
> On May 31, 2010, at 8:56 AM, Andrew Dunstan wrote:
>> I don't have strong feelings about the timing - I'd be very surprised if := were to be used in this context for any other purpose, so I don't think we'd be biting ourselves too much by just using that now. But if we do that, we should deprecate use of => as an operator now, and definitely remove its use in hstore either now or in 9.1.

My feeling is that (a) there is no hurry to do anything about an
unreleased draft of the standard, and (b) perhaps Peter could lobby
the committee to change the standard before it does get published.

hstore's use of => is pretty well embedded already; waiting another
release or two before breaking things is not going to make it
significantly more painful.

regards, tom lane


From: Florian Pflug <fgp(at)phlo(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "David E(dot) Wheeler" <david(at)kineticode(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Bruce Momjian <bruce(at)momjian(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-06-01 01:24:26
Message-ID: C88D37EB-8DCF-4895-810A-01A680E3DF12@phlo.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Jun 1, 2010, at 0:23 , Tom Lane wrote:
> "David E. Wheeler" <david(at)kineticode(dot)com> writes:
>> On May 31, 2010, at 8:56 AM, Andrew Dunstan wrote:
>>> I don't have strong feelings about the timing - I'd be very surprised if := were to be used in this context for any other purpose, so I don't think we'd be biting ourselves too much by just using that now. But if we do that, we should deprecate use of => as an operator now, and definitely remove its use in hstore either now or in 9.1.
>
> My feeling is that (a) there is no hurry to do anything about an
> unreleased draft of the standard, and (b) perhaps Peter could lobby
> the committee to change the standard before it does get published.
>
> hstore's use of => is pretty well embedded already; waiting another
> release or two before breaking things is not going to make it
> significantly more painful.

There might be some value in providing an alternative operator though, even if there is no definitive plan to deprecate '=>'.

hstore gained quite a few new features in 9.0 that might attract new users. If there is even a slight chance that '=>' will be deprecated during the next few releases, it'd be nice to save these users the hassle of migration...

For text => text and text[] => text[] I'd propose '||>' as an alternative, since they both combine their arguments, kind of a like a concatenation.
For hstore => text[] I'd suggest '&>' since the result's set of keys is the intersection of both argument's key-sets.

best regards,
Florian Pflug


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Florian Pflug <fgp(at)phlo(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "David E(dot) Wheeler" <david(at)kineticode(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Bruce Momjian <bruce(at)momjian(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-06-01 02:40:35
Message-ID: AANLkTik9AVOzx1qkwraiWBUN2HYKdBk4aLaZoCJKrB4s@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Mon, May 31, 2010 at 9:24 PM, Florian Pflug <fgp(at)phlo(dot)org> wrote:
> On Jun 1, 2010, at 0:23 , Tom Lane wrote:
>> "David E. Wheeler" <david(at)kineticode(dot)com> writes:
>>> On May 31, 2010, at 8:56 AM, Andrew Dunstan wrote:
>>>> I don't have strong feelings about the timing - I'd be very surprised if := were to be used in this context for any other purpose, so I don't think we'd be biting ourselves too much by just using that now. But if we do that, we should deprecate use of => as an operator now, and definitely remove its use in hstore either now or in 9.1.
>>
>> My feeling is that (a) there is no hurry to do anything about an
>> unreleased draft of the standard, and (b) perhaps Peter could lobby
>> the committee to change the standard before it does get published.
>>
>> hstore's use of => is pretty well embedded already; waiting another
>> release or two before breaking things is not going to make it
>> significantly more painful.
>
>
> There might be some value in providing an alternative operator though, even if there is no definitive plan to deprecate '=>'.
>
> hstore gained quite a few new features in 9.0 that might attract new users. If there is even a slight chance that '=>' will be deprecated during the next few releases, it'd be nice to save these users the hassle of migration...
>
> For text => text and text[] => text[] I'd propose '||>' as an alternative, since they both combine their arguments, kind of a like a concatenation.
> For hstore => text[] I'd suggest '&>' since the result's set of keys is the intersection of both argument's key-sets.

I was going to propose ==> across the board.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company


From: "David E(dot) Wheeler" <david(at)kineticode(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Florian Pflug <fgp(at)phlo(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Bruce Momjian <bruce(at)momjian(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-06-01 03:26:48
Message-ID: CB4DF10D-8C2A-4596-8CDC-DC7E2C703DDF@kineticode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On May 31, 2010, at 7:40 PM, Robert Haas wrote:

> I was going to propose ==> across the board.

What about -> ?

D


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "David E(dot) Wheeler" <david(at)kineticode(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Florian Pflug <fgp(at)phlo(dot)org>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Bruce Momjian <bruce(at)momjian(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-06-01 03:36:03
Message-ID: 24882.1275363363@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

"David E. Wheeler" <david(at)kineticode(dot)com> writes:
> On May 31, 2010, at 7:40 PM, Robert Haas wrote:
>> I was going to propose ==> across the board.

> What about -> ?

hstore already uses that for something else.

Robert's idea isn't a bad one if we're forced to rename the operator.
I'd still like to know exactly how hard the concrete has set on the
SQL spec draft, first. (Peter?)

regards, tom lane


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "David E(dot) Wheeler" <david(at)kineticode(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Florian Pflug <fgp(at)phlo(dot)org>, Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-06-01 03:44:39
Message-ID: 201006010344.o513idX28605@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Tom Lane wrote:
> "David E. Wheeler" <david(at)kineticode(dot)com> writes:
> > On May 31, 2010, at 7:40 PM, Robert Haas wrote:
> >> I was going to propose ==> across the board.
>
> > What about -> ?
>
> hstore already uses that for something else.
>
> Robert's idea isn't a bad one if we're forced to rename the operator.
> I'd still like to know exactly how hard the concrete has set on the
> SQL spec draft, first. (Peter?)

I don't know, but based on the fact it matches Oracle, I think it is
pretty well set by now.

If we can't come up with a good syntax (and there isn't an SQL standard
for it), we often review how Oracle or other databases handle such
cases, and my guess is that the SQL committee does the same thing.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ None of us is going to be here forever. +


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "David E(dot) Wheeler" <david(at)kineticode(dot)com>, Florian Pflug <fgp(at)phlo(dot)org>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Bruce Momjian <bruce(at)momjian(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-06-01 03:48:58
Message-ID: AANLkTim09yzPtzMSqjPets0Rj1mjwcR2lnnWDGS4wMu5@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Mon, May 31, 2010 at 11:36 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> "David E. Wheeler" <david(at)kineticode(dot)com> writes:
>> On May 31, 2010, at 7:40 PM, Robert Haas wrote:
>>> I was going to propose ==> across the board.
>
>> What about -> ?
>
> hstore already uses that for something else.
>
> Robert's idea isn't a bad one if we're forced to rename the operator.
> I'd still like to know exactly how hard the concrete has set on the
> SQL spec draft, first.  (Peter?)

Given the way hstore uses ->, another reasonable choice might be -->

That way we'd have -> and --> instead of -> and ==>

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: "David E(dot) Wheeler" <david(at)kineticode(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Florian Pflug <fgp(at)phlo(dot)org>, Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-06-01 03:51:00
Message-ID: 25088.1275364260@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Bruce Momjian <bruce(at)momjian(dot)us> writes:
> Tom Lane wrote:
>> I'd still like to know exactly how hard the concrete has set on the
>> SQL spec draft, first. (Peter?)

> I don't know, but based on the fact it matches Oracle, I think it is
> pretty well set by now.

Eh? The SQL committee has a very long track record of blowing off
any and all Oracle syntaxes. If we can point to good reasons to adjust
their syntax, they might still listen. Or at least I'd like to hear
the opinion of our man on the ground before assuming they won't.

regards, tom lane


From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "David E(dot) Wheeler" <david(at)kineticode(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Florian Pflug <fgp(at)phlo(dot)org>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Bruce Momjian <bruce(at)momjian(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-06-01 04:40:56
Message-ID: AANLkTinACNixo1nqbnlWjBNtvCd1TubReBq3CbOLzoEP@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

2010/6/1 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
> "David E. Wheeler" <david(at)kineticode(dot)com> writes:
>> On May 31, 2010, at 7:40 PM, Robert Haas wrote:
>>> I was going to propose ==> across the board.
>
>> What about -> ?
>
> hstore already uses that for something else.
>
> Robert's idea isn't a bad one if we're forced to rename the operator.
> I'd still like to know exactly how hard the concrete has set on the
> SQL spec draft, first.  (Peter?)
>

I agree with Tom - we are not hurry. Creating some synonym operator
for hstore like "==>" can be a good idea.

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: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "David E(dot) Wheeler" <david(at)kineticode(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Bruce Momjian <bruce(at)momjian(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-06-01 09:23:05
Message-ID: 1275384185.15468.2.camel@fsopti579.F-Secure.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On mån, 2010-05-31 at 18:23 -0400, Tom Lane wrote:
> My feeling is that (a) there is no hurry to do anything about an
> unreleased draft of the standard, and (b) perhaps Peter could lobby
> the committee to change the standard before it does get published.

Given that Oracle and DB2 already support that syntax in released
products, and I'm not even a member of any relevant body, that seems
pretty much impossible.


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "David E(dot) Wheeler" <david(at)kineticode(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-06-03 15:17:53
Message-ID: 201006031517.o53FHrR21032@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Peter Eisentraut wrote:
> On m?n, 2010-05-31 at 18:23 -0400, Tom Lane wrote:
> > My feeling is that (a) there is no hurry to do anything about an
> > unreleased draft of the standard, and (b) perhaps Peter could lobby
> > the committee to change the standard before it does get published.
>
> Given that Oracle and DB2 already support that syntax in released
> products, and I'm not even a member of any relevant body, that seems
> pretty much impossible.

With beta2 being wrapped today, we are going to be releasing ':=' as our
method for function parameter assignment, but also with the likely
outcome that we are going to need to support '=>' very soon.

Are we sure we want hstore compatibility to drive this decision?

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ None of us is going to be here forever. +


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, "David E(dot) Wheeler" <david(at)kineticode(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-06-03 15:28:49
Message-ID: 26873.1275578929@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Bruce Momjian <bruce(at)momjian(dot)us> writes:
> Are we sure we want hstore compatibility to drive this decision?

hstore is what it is, and has been that way for a long time. We can't
just ignore it. And I don't think breaking it (and probably other code)
on zero notice is an acceptable outcome.

regards, tom lane


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, "David E(dot) Wheeler" <david(at)kineticode(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-06-03 15:34:04
Message-ID: 201006031534.o53FY4H24091@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Tom Lane wrote:
> Bruce Momjian <bruce(at)momjian(dot)us> writes:
> > Are we sure we want hstore compatibility to drive this decision?
>
> hstore is what it is, and has been that way for a long time. We can't
> just ignore it. And I don't think breaking it (and probably other code)
> on zero notice is an acceptable outcome.

Well, it seems we are going to be stuck supporting => because it is hard
to argue that the SQL standards committee should adopt := instead of =>
because of hstore. ;-)

I hate eventually having two documented ways of doing something, but it
appears by releasing := we are doing exactly that.

Is telling hstore users they have to change => to something else such a
large major version incompatibility that it is worth supporting and
documenting two syntaxes for parameter assignment? It is that calculus
that has me questioning our approach.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ None of us is going to be here forever. +


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Eisentraut <peter_e(at)gmx(dot)net>, "David E(dot) Wheeler" <david(at)kineticode(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-06-03 15:44:17
Message-ID: AANLkTikPEPpjy1zCVzCLEdjK8e0x36L9TSJPbzQ81Nuc@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Jun 3, 2010 at 11:34 AM, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
> Tom Lane wrote:
>> Bruce Momjian <bruce(at)momjian(dot)us> writes:
>> > Are we sure we want hstore compatibility to drive this decision?
>>
>> hstore is what it is, and has been that way for a long time.  We can't
>> just ignore it.  And I don't think breaking it (and probably other code)
>> on zero notice is an acceptable outcome.
>
> Well, it seems we are going to be stuck supporting => because it is hard
> to argue that the SQL standards committee should adopt := instead of =>
> because of hstore.  ;-)
>
> I hate eventually having two documented ways of doing something, but it
> appears by releasing := we are doing exactly that.
>
> Is telling hstore users they have to change => to something else such a
> large major version incompatibility that it is worth supporting and
> documenting two syntaxes for parameter assignment?  It is that calculus
> that has me questioning our approach.

I don't mind supporting := and => as much as I mind supporting only
:=, and I think that's the other reasonable alternative.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Eisentraut <peter_e(at)gmx(dot)net>, "David E(dot) Wheeler" <david(at)kineticode(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-06-03 15:44:37
Message-ID: 201006031544.o53FibW25806@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Bruce Momjian wrote:
> Tom Lane wrote:
> > Bruce Momjian <bruce(at)momjian(dot)us> writes:
> > > Are we sure we want hstore compatibility to drive this decision?
> >
> > hstore is what it is, and has been that way for a long time. We can't
> > just ignore it. And I don't think breaking it (and probably other code)
> > on zero notice is an acceptable outcome.
>
> Well, it seems we are going to be stuck supporting => because it is hard
> to argue that the SQL standards committee should adopt := instead of =>
> because of hstore. ;-)
>
> I hate eventually having two documented ways of doing something, but it
> appears by releasing := we are doing exactly that.
>
> Is telling hstore users they have to change => to something else such a
> large major version incompatibility that it is worth supporting and
> documenting two syntaxes for parameter assignment? It is that calculus
> that has me questioning our approach.

Thinking some more, what is the value of keeping => in hstore for 9.0?
Perhaps we could create a script they could run on 8.4 that would add
support for the new hstore operator to replace =>, and then they can
upgrade to 9.0 when they are ready. I see only three mentions of => in
hstore.sql. Do we really want to keep the := baggage forever just for
hstore?

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ None of us is going to be here forever. +


From: Dimitri Fontaine <dfontaine(at)hi-media(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Eisentraut <peter_e(at)gmx(dot)net>, "David E(dot) Wheeler" <david(at)kineticode(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-06-03 15:53:09
Message-ID: 877hmgt8nu.fsf@hi-media-techno.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Bruce Momjian <bruce(at)momjian(dot)us> writes:
> Is telling hstore users they have to change => to something else such a
> large major version incompatibility that it is worth supporting and
> documenting two syntaxes for parameter assignment? It is that calculus
> that has me questioning our approach.

Well it's not only hstore. Anyone can CREATE OPERATOR => on any released
version of PostgreSQL currently. I don't think we can deprecate it on
short notice, so we'll have := in 9.0, and maybe a deprecation notice
for =>.

Now that it's pretty clear from Peter that the standard is not going to
change its choice here, I'll vote adding a WARNING each time an operator
called => is created, so that we get a chance to move later on.

Regards,
--
dim


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, "David E(dot) Wheeler" <david(at)kineticode(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-06-03 15:54:54
Message-ID: 5657.1275580494@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Bruce Momjian <bruce(at)momjian(dot)us> writes:
> Thinking some more, what is the value of keeping => in hstore for 9.0?

Backwards compatibility. You have not made any argument today that we
have not been over many times before. I do not have time to argue
about this today --- I have to go fix max_standby_delay.

regards, tom lane


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, "David E(dot) Wheeler" <david(at)kineticode(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-06-03 16:00:37
Message-ID: 201006031600.o53G0bl01519@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Tom Lane wrote:
> Bruce Momjian <bruce(at)momjian(dot)us> writes:
> > Thinking some more, what is the value of keeping => in hstore for 9.0?
>
> Backwards compatibility. You have not made any argument today that we
> have not been over many times before. I do not have time to argue
> about this today --- I have to go fix max_standby_delay.

Agreed. I am just making sure we are going in the right direction.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ None of us is going to be here forever. +


From: "David E(dot) Wheeler" <david(at)kineticode(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-06-03 16:04:26
Message-ID: FD04E171-75A6-457A-9599-4EA128B6552A@kineticode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Jun 3, 2010, at 8:54 AM, Tom Lane wrote:

>> Thinking some more, what is the value of keeping => in hstore for 9.0?
>
> Backwards compatibility. You have not made any argument today that we
> have not been over many times before. I do not have time to argue
> about this today --- I have to go fix max_standby_delay.

I'm sure there's a lot of code using => in the wild. We can't just drop them without a deprecation cycle.

Best,

David


From: "David E(dot) Wheeler" <david(at)kineticode(dot)com>
To: Dimitri Fontaine <dfontaine(at)hi-media(dot)com>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-06-03 16:05:09
Message-ID: 837B023C-E18D-47FC-B523-E9E7B28DAEDA@kineticode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Jun 3, 2010, at 8:53 AM, Dimitri Fontaine wrote:

> Now that it's pretty clear from Peter that the standard is not going to
> change its choice here, I'll vote adding a WARNING each time an operator
> called => is created, so that we get a chance to move later on.

Should support for ==> be added to hstore for 9.0? So both => and ==> will work?

Best,

David


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: "David E(dot) Wheeler" <david(at)kineticode(dot)com>
Cc: Dimitri Fontaine <dfontaine(at)hi-media(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-06-03 16:13:34
Message-ID: 201006031613.o53GDY409304@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

David E. Wheeler wrote:
> On Jun 3, 2010, at 8:53 AM, Dimitri Fontaine wrote:
>
> > Now that it's pretty clear from Peter that the standard is not going to
> > change its choice here, I'll vote adding a WARNING each time an operator
> > called => is created, so that we get a chance to move later on.
>
> Should support for ==> be added to hstore for 9.0? So both => and ==> will work?

I have added the idea to the 9.0 open items wiki:

http://wiki.postgresql.org/wiki/PostgreSQL_9.0_Open_Items#Code

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ None of us is going to be here forever. +


From: Jan Wieck <JanWieck(at)Yahoo(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-06-04 02:47:06
Message-ID: 4C08692A.9060003@Yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 5/27/2010 11:52 PM, Andrew Dunstan wrote:
>
> Bruce Momjian wrote:
>> Peter Eisentraut wrote:
>>
>>> On tor, 2010-05-27 at 12:59 -0400, Tom Lane wrote:
>>>
>>>>> I think we should fix it now. Quick thought: maybe we could use
>>>>>
>>>> FOR
>>>>
>>>>> instead of AS: select myfunc(7 for a, 6 for b);
>>>>>
>>>> I'm afraid FOR doesn't work either; it'll create a conflict with the
>>>> spec-defined SUBSTRING(x FOR y) syntax.
>>>>
>>> How about
>>>
>>> select myfunc(a := 7, b := 6);
>>>
>>
>> One concern I have is that in PL/pgSQL, := and = behave the same, while
>> in SQL, they would not. That might cause confusion.
>>
>>
>
> That is a sad wart that we should never have done, IMNSHO (it was before
> my time or I would have objected ;-) ). But beyond that, = is an
> operator in SQL and := is never an operator, IIRC.

As far as I can tell, this was already in the code when Bruce moved it
into core as -r1.1 on my behalf (before I had commit privileges). I do
not recall if the = as alternative to := was my idea or not. But I'm
willing to take the blame for it because it dates back to a time where
convenience seemed important.

Jan

--
Anyone who trades liberty for security deserves neither
liberty nor security. -- Benjamin Franklin


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Jan Wieck <JanWieck(at)Yahoo(dot)com>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-06-04 03:09:12
Message-ID: 4C086E58.9020909@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Jan Wieck wrote:
>>
>> That is a sad wart that we should never have done, IMNSHO (it was
>> before my time or I would have objected ;-) ). But beyond that, = is
>> an operator in SQL and := is never an operator, IIRC.
>
> As far as I can tell, this was already in the code when Bruce moved it
> into core as -r1.1 on my behalf (before I had commit privileges). I do
> not recall if the = as alternative to := was my idea or not. But I'm
> willing to take the blame for it because it dates back to a time where
> convenience seemed important.
>

I forgive you ;=) If my worst sin were only this bad I'd be truly happy.

cheers

andrew


From: Joseph Adams <joeyadams3(dot)14159(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, alvherre <alvherre(at)commandprompt(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-06-05 01:55:56
Message-ID: AANLkTikmSY4_PQAiWqRqk4poVQEoHiaKdQXhBFd2YQuf@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, May 26, 2010 at 9:28 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>> On Wed, May 26, 2010 at 8:21 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>> If we go with the spec's syntax I think we'd have no realistic choice
>>> except to forbid => altogether as an operator name.  (And no, I'm not
>>> for that.)
>
>> I suppose the most painful thing about doing that is that it would
>> break hstore.  Are there other commonly-used modules that rely on =>
>> as an operator name?
>
> There don't seem to be any other contrib modules that define => as an
> operator name, but I'm not sure what's out there on pgfoundry or
> elsewhere.  The bigger issue to me is not so much hstore itself as that
> this is an awfully attractive operator name for anything container-ish.
> Wasn't the JSON-datatype proposal using => for an operator at one stage?
> (The current wiki page for it doesn't seem to reflect any such idea,
> though.)  And I think I remember Oleg & Teodor proposing such an
> operator in conjunction with some GIN-related idea or other.
>
>> In spite of the difficulties, I'm reluctant to give up on it.  I
>> always thought that the "AS" syntax was a crock and I'm not eager to
>> invent another crock to replace it.  Being compatible with the SQL
>> standard and with Oracle is not to be taken lightly.
>
> Yeah, I know.  Though this could end up being one of the bits of the
> spec that we politely decline to follow, like upper-casing identifiers.
> Still, it's a good idea to think again before we've set the release
> in stone ...
>
>                        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
>

I didn't really consider using => for json because it would interfere
with hstore (one of the signatures is text => text returns hstore, for
instance). I am considering using -> as a json subscript operator
(which is what hstore does) as it shouldn't interfere with hstore (as
far as I know).

Here's a thought: suppose we did use the foo (name => value) syntax
for naming parameters. It could still be used in a very similar way
for hstore:

hstore(key1 => 'value1', key2 => 'value2')

One advantage here is that => wouldn't be exclusive to hstore anymore. E.g.:

json(key1 => 'value1', key2 => 'value2')

However, note that the left hand of => is an identifier here, whereas
the left hand of hstore's current => operator is either text, text[],
or hstore.

If I had to choose between => and := for parameter naming, I'd go with
:= because it seems more SQLish to me.

I wonder if the foo (name : value) syntax would be possible/desirable.
Or maybe foo ({name: value}) :-)

Joey Adams


From: Joseph Adams <joeyadams3(dot)14159(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, alvherre <alvherre(at)commandprompt(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-06-05 02:07:12
Message-ID: AANLkTimn00fdGTNfu7udvXDAy0gKu4gbZ030_68Wzgtb@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Fri, Jun 4, 2010 at 9:55 PM, Joseph Adams <joeyadams3(dot)14159(at)gmail(dot)com> wrote:
> If I had to choose between => and := for parameter naming, I'd go with
> := because it seems more SQLish to me.

On second thought, => might actually be a very intuitive syntax for
defining dictionary types like hstore and json, since it matches PHP's
associative array syntax, as in:

hstore('key1' => 'value1', 'key2' => 'value2') -- hypothetical SQL
array('key1' => 'value1', 'key2' => 'value2') // PHP

That way, when people see =>, they can think "dictionary" whether
they're in PHP or SQL.

Note that this is a bit different than what I suggested earlier:

hstore(key1 => 'value1', key2 => 'value2')

Identifier names were used instead of literal names, which conflicts
with the other approach. Also, the other approach is more flexible,
as the user can generate names with expressions at runtime.


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Joseph Adams <joeyadams3(dot)14159(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, alvherre <alvherre(at)commandprompt(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-06-05 14:02:38
Message-ID: 4641.1275746558@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Joseph Adams <joeyadams3(dot)14159(at)gmail(dot)com> writes:
> Here's a thought: suppose we did use the foo (name => value) syntax
> for naming parameters. It could still be used in a very similar way
> for hstore:

> hstore(key1 => 'value1', key2 => 'value2')

No, that really isn't going to work: how will the parser know that the
names are not meant to match to actual named parameters of the function?
You could possibly do it with a special case for hstore() in the
grammar, but we aren't going there, because it wouldn't be extensible.

The other variant with 'key1' => 'value1' isn't a lot better. Yes,
we could make it work since it can't possibly be name => value, but
it would be impossibly error-prone for people to use. The assumption
that you can always replace a constant by a variable is very deeply
wired into users' thinking, but doing so would make for a radical change
in what the syntax meant.

From a usability point of view, if we adopt the spec's syntax we have to
stop allowing => for any other purpose. Period.

regards, tom lane


From: Greg Stark <gsstark(at)mit(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Joseph Adams <joeyadams3(dot)14159(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, alvherre <alvherre(at)commandprompt(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-06-05 14:32:07
Message-ID: AANLkTilh9z0tn4bodINPJYqKN4cL0aJdEzfz86Hk0ShB@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Sat, Jun 5, 2010 at 3:02 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> No, that really isn't going to work: how will the parser know that the
> names are not meant to match to actual named parameters of the function?
> You could possibly do it with a special case for hstore() in the
> grammar, but we aren't going there, because it wouldn't be extensible.
>

I wonder if we could offer something like VARIADIC but allows
arbitrarily named parameters which get passed in a hstore-like hash
instead of an array. Just thinking aloud here. I haven't thought about
what this would mean in the function call api.

--
greg


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Greg Stark <gsstark(at)mit(dot)edu>
Cc: Joseph Adams <joeyadams3(dot)14159(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, alvherre <alvherre(at)commandprompt(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-06-05 14:59:27
Message-ID: 5383.1275749967@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Greg Stark <gsstark(at)mit(dot)edu> writes:
> I wonder if we could offer something like VARIADIC but allows
> arbitrarily named parameters which get passed in a hstore-like hash
> instead of an array. Just thinking aloud here. I haven't thought about
> what this would mean in the function call api.

Yeah, with an extra keyword to disambiguate, you could make that work.
Not sure if there are enough use-cases to justify it though.

regards, tom lane


From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Greg Stark <gsstark(at)mit(dot)edu>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Joseph Adams <joeyadams3(dot)14159(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, alvherre <alvherre(at)commandprompt(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-06-05 16:54:46
Message-ID: AANLkTil4g5bX6t_yz5H4TZOk25mE-GORHtVnbZeoQkT5@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

2010/6/5 Greg Stark <gsstark(at)mit(dot)edu>:
> On Sat, Jun 5, 2010 at 3:02 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> No, that really isn't going to work: how will the parser know that the
>> names are not meant to match to actual named parameters of the function?
>> You could possibly do it with a special case for hstore() in the
>> grammar, but we aren't going there, because it wouldn't be extensible.
>>
>
> I wonder if we could offer something like VARIADIC but allows
> arbitrarily named parameters which get passed in a hstore-like hash
> instead of an array. Just thinking aloud here. I haven't thought about
> what this would mean in the function call api.
>

I like this idea. Using a named expression for variadic parameter can
be way. Maybe have to be explicitly enabled. Then we don't need
special keyword or special syntax.

like

CREATE OR REPLACE FUNCTION hstore_constructor(VARIADIC params "anyelement"[])
AS $$ ... $$ STORE_PARAM_NAMES

and maybe we can emulate old behave of hstore.

Regards
Pavel Stehule

> --
> greg
>
> --
> 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: "David E(dot) Wheeler" <david(at)kineticode(dot)com>
To: pgsql-hackers Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-06-05 17:08:52
Message-ID: C31178C4-4DB5-44FE-BBF4-DFEE69E006CE@kineticode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Jun 5, 2010, at 7:02 AM, Tom Lane wrote:

> From a usability point of view, if we adopt the spec's syntax we have to
> stop allowing => for any other purpose. Period.

What if we added a new "dual" type and limited the => operator only to that type, being, essentially, a constructor. Then hstore and function call param processing could be rewritten to transform those types into key/value pairs.

So you'd call functions with:

foo( bar => 1, baz => 'this');

Actually, now that I think about it, the hstore => basically does this: it constructs an hstore from its two values. So why not basically move hstore into core and just use it for function arguments?

Crazy idea, I know, but thought I'd just throw it out there.

Best,

David


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: "David E(dot) Wheeler" <david(at)kineticode(dot)com>
Cc: pgsql-hackers Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: functional call named notation clashes with SQL feature
Date: 2010-06-05 20:32:49
Message-ID: 4C0AB471.2020209@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

David E. Wheeler wrote:
> On Jun 5, 2010, at 7:02 AM, Tom Lane wrote:
>
>
>> From a usability point of view, if we adopt the spec's syntax we have to
>> stop allowing => for any other purpose. Period.
>>
>
> What if we added a new "dual" type and limited the => operator only to that type, being, essentially, a constructor. Then hstore and function call param processing could be rewritten to transform those types into key/value pairs.
>
> So you'd call functions with:
>
> foo( bar => 1, baz => 'this');
>
> Actually, now that I think about it, the hstore => basically does this: it constructs an hstore from its two values. So why not basically move hstore into core and just use it for function arguments?
>
> Crazy idea, I know, but thought I'd just throw it out there.
>

I'm fairly strongly inclined to go with Tom's original dictum above.
Even if it's not strictly true, doing anything else is likely to be
rather fragile, ISTM.

cheers

andrew