Not all functions in schema pg_catalog are "visible"

Поиск
Список
Период
Сортировка
Искать

Not all functions in schema pg_catalog are "visible"

От:
Thomas Kellerer <spam_eater@gmx.net>
Дата:
Hi,

I just noticed that that there are functions defined (such as pg_catalog.time(timestamp) that can only be called when prefixed with pg_catalog. However other functions (that are at first glance defined identically to time()) can be called without prefixing them with pg_catalog.

My understanding is that time(timestamp) is there to support the various CAST ( .. ) expressions, but why isn't it exposed as a "regular" function as well (as it seems to work just fine when being called directly)

So, just out of curiosity: how could I tell by looking at pg_proc (or other system tables) which of those functions is "public" and which is not?

Regards
Thomas

Re: Not all functions in schema pg_catalog are "visible"

От:
Alvaro Herrera <alvherre@commandprompt.com>
Дата:
Thomas Kellerer wrote:
> Hi,
> 
> I just noticed that that there are functions defined (such as pg_catalog.time(timestamp) that can only be called when prefixed with pg_catalog. However other functions (that are at first glance defined identically to time()) can be called without prefixing them with pg_catalog.

I think it's not that they are visible but rather that their names are
keywords.  So you could also call them by quoting them, e.g.
"time"(timestamp).  IIRC there's a view listing all keywords you can use
to figure this out.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
FAQ