Re: ('dog$house' = quote_ident('dog$house')) is surprisingly FALSE

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Bryn Llewellyn <bryn(at)yugabyte(dot)com>, pgsql-general list <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: ('dog$house' = quote_ident('dog$house')) is surprisingly FALSE
Date: 2022-10-06 01:20:26
Message-ID: 2583527.1665019226@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> So I can see an argument for the existing behavior. It doesn't seem worth
> changing in any case. And I don't really see the documentation being
> improved by covering this corner case in detail when the current behavior
> is at least intuitive.

quote_ident is a good bit more conservative than the core lexer
about what is an "identifier character" --- it considers all
non-ASCII characters as requiring quoting, too.

For typical uses of quote_ident, I think this is good future-proofing:
it makes it very much less likely that something quote_ident decides
not to quote would be rejected by some future PG version (not to mention
non-PG SQL databases). So I'm not really in a hurry to change the code.
Maybe we should tweak the docs a bit.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2022-10-06 04:31:44 Re: ('dog$house' = quote_ident('dog$house')) is surprisingly FALSE
Previous Message David G. Johnston 2022-10-06 00:31:48 Re: ('dog$house' = quote_ident('dog$house')) is surprisingly FALSE