From: | Alvaro Herrera <alvherre(at)commandprompt(dot)com> |
---|---|
To: | Osvaldo Kussama <osvaldo(dot)kussama(at)gmail(dot)com> |
Cc: | Israel Brewster <israel(at)frontierflying(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: cross-database time extract? |
Date: | 2009-12-29 14:14:59 |
Message-ID: | 20091229141459.GD4569@alvh.no-ip.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Osvaldo Kussama escribió:
> bdteste=# SELECT "time"(CURRENT_TIMESTAMP);
> time
> -----------------
> 10:55:20.679684
> (1 registro)
>
> bdteste=# SELECT $$time$$(CURRENT_TIMESTAMP);
> ERRO: erro de sintaxe em ou próximo a "("
> LINE 1: SELECT $$time$$(CURRENT_TIMESTAMP);
> ^
Note that the reason the second query doesn't work is that $$ is a way
to replace quoting for string literals, i.e. what ' (single quote) does
normally. " (double quote) is used to quote identifiers, not literals.
Different thing.
When you write "time" you are invoking the function because it's parsed
as an identifier. When you write time (no quotes) you are invoking the
reserved keyword. The double quotes strip the "reservedness" and it's
treated like an ordinary keyword. When you write pg_catalog.time this
is parsed as an identifier too because keywords cannot be
schema-qualified.
--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.
From | Date | Subject | |
---|---|---|---|
Next Message | Adrian Klaver | 2009-12-29 14:41:46 | Re: cross-database time extract? |
Previous Message | Adrian Klaver | 2009-12-29 14:07:14 | Re: cross-database time extract? |