Mark Simon <m...@manngo.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