Re: A table of magic constants

From: "Charles Clavadetscher" <clavadetscher(at)swisspug(dot)org>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Re: A table of magic constants
Date: 2015-07-11 21:14:10
Message-ID: 00c301d0bc1e$8ce541e0$a6afc5a0$@swisspug.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Dane

There is a list of reserved keywords, including the ones that you mentioned.

<http://www.postgresql.org/docs/9.5/static/sql-keywords-appendix.html> http://www.postgresql.org/docs/9.5/static/sql-keywords-appendix.html

However you still need to search for their meaning.

Maybe it helps.

Bye

Charles

From: pgsql-general-owner(at)postgresql(dot)org [mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of Dane Foster
Sent: Samstag, 11. Juli 2015 22:56
To: Adrian Klaver
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] A table of magic constants

Hello Adrian,

Thank you for the additional reference links but my concern was less about how to find out what a function (formerly magic constant) that I encountered in the wild did but more about having a list that would educate newcomers/me about what is automatically available for use. For example, in the RLS example from my original message, had I the same or similar need as the poster I would not have been able to formulate the policy that I quoted because I had no clue that SESSION_USER even existed. Specifically I would not have been able to formulate the following clause, "... WITH CHECK (username = SESSION_USER)", w/o first knowing that SESSION_USER was a thing.

​Regards,​

Dane

On Sat, Jul 11, 2015 at 3:54 PM, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com <mailto:adrian(dot)klaver(at)aklaver(dot)com> > wrote:

On 07/11/2015 12:21 PM, Raymond O'Donnell wrote:

On 11/07/2015 20:07, Dane Foster wrote:

<snip>

As a recent convert to the Church of Postgres I've been consuming vast

Welcome to the One True Faith! :-)

amounts of information on PostgreSQL, and SESSION_USER is not the first
nor only, what I'm calling magic constant, that I've seen. Off the top
of my head, other examples that I've encountered are CURRENT_USER and
CURRENT_TIMESTAMP.

So my question is this, is there a reference table in the documentation
that I haven't found yet that lists all magic constants and their
meaning? And if not in the official documentation is it in the wiki?

session_user, current_timestamp and current_user are all functions, not
magic constants:

http://www.postgresql.org/docs/9.4/static/functions-datetime.html
http://www.postgresql.org/docs/9.4/static/functions-info.html

I hope this helps,

To add to this. In the documentation section:

http://www.postgresql.org/docs/9.4/interactive/index.html

there is a Search box where you can enter the word/phrase you are looking for.

If all else fails there is the Index:

http://www.postgresql.org/docs/9.4/interactive/index.html

Ray.

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com <mailto:adrian(dot)klaver(at)aklaver(dot)com>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2015-07-11 21:26:38 Re: A table of magic constants
Previous Message Dane Foster 2015-07-11 20:55:44 Re: A table of magic constants