Re: Feature Request: Allow additional special characters at the beginning of the name.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Mark Simon <mark(at)manngo(dot)net>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Feature Request: Allow additional special characters at the beginning of the name.
Date: 2021-10-13 02:49:28
Message-ID: 614222.1634093368@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Mark Simon <mark(at)manngo(dot)net> writes:
> I’m not asking for a change in how PostgreSQL manages variables, but
> whether it’s possible to allow the @ sign, and possibly the $ sign to
> start a variable name.

@ is allowed in operator names, and indeed is used in (mumble select
count(*) ...) 59 built-in operators. So we could not support that
without breaking a lot of applications. Is "a<@b" to be parsed as
"a <@ b" or "a < @b"? For that matter, is "@a" a name or an invocation
of the built-in prefix operator "@" on variable "a"?

As for allowing $ to start a name, there are also issues:

* It'd be rather ambiguous with the $id$ string delimiter syntax [1],
which is a Postgres-ism for sure, but a lot of people use it.

* It'd not be entirely clear whether $1 is a variable name
or a parameter reference.

* I think there are client interfaces that allow $name to be
a parameter symbol, so we'd also be breaking anything that
works that way.

Maybe we could have done this twenty years ago, but I think
compatibility considerations preclude it now.

regards, tom lane

[1] https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-DOLLAR-QUOTING

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2021-10-13 03:41:17 Re: [BUG] Unexpected action when publishing partition tables
Previous Message houzj.fnst@fujitsu.com 2021-10-13 02:48:37 RE: Added schema level support for publication.