Re: Unable to create function which takes no arguments

Поиск
Список
Период
Сортировка
От Mark Roberts
Тема Re: Unable to create function which takes no arguments
Дата
Msg-id 1213030002.9666.22.camel@localhost
обсуждение исходный текст
Ответ на Unable to create function which takes no arguments  (Michael Eshom <oldiesmann@oldiesmann.us>)
Список pgsql-sql
IIRC, current_timestamp doesn't require parens.  You could try something
like this:

select extract(epoch from current_timestamp)::int4 as result;

-Mark
On Mon, 2008-06-09 at 12:05 -0400, Michael Eshom wrote:
> 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
> 
> 



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

Предыдущее
От: hubert depesz lubaczewski
Дата:
Сообщение: Re: Unable to create function which takes no arguments
Следующее
От: Patrick Scharrenberg
Дата:
Сообщение: returning results from an update for joining other tables