Search Postgresql Archives

Re: cross-database time extract?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux