Re: How to quote the COALESCE function?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Roman Scherer <roman(at)burningswell(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to quote the COALESCE function?
Date: 2016-03-28 23:30:56
Message-ID: 25882.1459207856@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Roman Scherer <roman(at)burningswell(dot)com> writes:
> Can someone explain to me what's the difference between quoting
> the `upper` and the `coalesce` function?

COALESCE is a keyword.

> What I found so far is, that the `upper` function can be found in
> the `pg_proc` table but not `coalesce`.

Yup.

> Does this mean that `coalesce` isn't a classical function and I
> shouldn't quote it? Is it instead a keyword, as described in
> the "Lexical Structure" section of the docs [2]? How can I find
> out which other functions are not meant to be quoted?

Yes, yes, and you already found one good way: if it doesn't have
a pg_proc entry then it's a special case of some sort or other.

Have you considered only quoting the function name if it actually
needs it, ie, contains special characters?

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jerry Sievers 2016-03-28 23:31:26 Re: How to quote the COALESCE function?
Previous Message John Turner 2016-03-28 23:23:38 Re: Unique values on multiple tables