From: | "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | "Michael Eshom" <oldiesmann(at)oldiesmann(dot)us> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Unable to create function which takes no arguments |
Date: | 2008-06-09 16:48:56 |
Message-ID: | 162867790806090948td1b2cd4p5dbbd67e3120dbd9@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Hello
current_timestamp is some more than less constant :)
try, please
postgres=# select extract(epoch from current_timestamp);
date_part
------------------
1213030028.17068
(1 row)
or
postgres=# select extract(epoch from current_timestamp)::int;
date_part
------------
1213030113
(1 row)
Pavel
2008/6/9 Michael Eshom <oldiesmann(at)oldiesmann(dot)us>:
> I am a project manager for a popular forum system. We are adding support for
> PostgreSQL in the next version (which is currently in beta), and have added
> several PostgreSQL functions to emulate MySQL functions of the same name.
>
> I am trying to create a "UNIX_TIMESTAMP()" function in PostgreSQL, which
> will return the current timestamp. However, whenever I try to add this
> function in phpPgAdmin, it says 'Syntax error at or near ")" at character
> 28'.
>
> This is the SQL I'm using:
>
> CREATE FUNCTION unix_timestamp() RETURNS integer AS '
> SELECT current_timestamp()::int4 AS result;
> ' LANGUAGE SQL;
>
> The documentation indicates that the arguments are optional, and even shows
> an example of a function with no arguments. How can I create this function?
> --
>
> Michael Eshom
> Christian Oldies Fan
> Cincinnati, Ohio
From | Date | Subject | |
---|---|---|---|
Next Message | hubert depesz lubaczewski | 2008-06-09 16:49:21 | Re: Unable to create function which takes no arguments |
Previous Message | Mark Roberts | 2008-06-09 16:46:42 | Re: Unable to create function which takes no arguments |