Re: now() vs current_user

Поиск
Список
Период
Сортировка
От Michael Glaesemann
Тема Re: now() vs current_user
Дата
Msg-id DF356A91-7364-43D7-A682-CBC1FF68528E@seespotcode.net
обсуждение исходный текст
Ответ на now() vs current_user  ("Ottó Havasvölgyi" <havasvolgyi.otto@gmail.com>)
Список pgsql-general
On Sep 5, 2007, at 15:31 , Ottó Havasvölgyi wrote:

> What is the cause that "now()" works but "now" does not and

now() is a PostgreSQL extension and not required by the SQL spec. For
the most part, PostgreSQL extensions are functions and look like
them. CURRENT_TIMESTAMP and CURRENT_DATE are required by the SQL spec
and return the appropriate values. IIRC, they call now() with casts,
if appropriate.

> "current_user" works

IIRC, CURRENT_USER (without parens) is required by the SQL spec. It's
most likely implemented in PostgreSQL using the current_user function
and special rules are added to the grammar to allow CURRENT_USER to
be accepted without parens.

> How can I decide if a function
> needs parentheses or not if it has no parameters?

Via the documentation. In general functions require parens. AIUI its
only when they are also SQL keywords that the parens are omitted (as
required by the spec).

Michael Glaesemann
grzm seespotcode net



В списке pgsql-general по дате отправления:

Предыдущее
От: "Ottó Havasvölgyi"
Дата:
Сообщение: now() vs current_user
Следующее
От: "Rodrigo De León"
Дата:
Сообщение: Re: now() vs current_user