> On Oct 5, 2022, at 17:16, Bryn Llewellyn <b...@yugabyte.com> wrote:
> B.t.w, the value of "quote_ident()" rests on the distinction between a name
> (what you provide with the function's actual argument) and an identifier
> (what it returns).
There is no first-class "identifier" type in PostgreSQL, so a function can't
"return an identifier." It returns a string which might, when placed into a
larger string and processed as SQL, be lexically correct as an identifier.
To be useful, quote_ident() can't fail to quote a string in such a way that
it's not a valid identifier to PostgreSQL. If it quotes some strings that
PostgreSQL would accept as identifiers without quotes, that's interesting, I
guess, but I'm not sure I see how it is a bug.
Pragmatically, what this function is for it to assemble SQL statements as
strings. Any review of its correctness needs to be based on a situation where
it can't be used for that.