Forum OpenACS Q&A: Re: postgresql syntax

Collapse
6: Re: postgresql syntax (response to 1)
Posted by Mat Kovach on
lack=# select (now() + INTERVAL '14 days') as time from dual;
            time
-------------------------------
2003-07-25 12:39:47.894596-04
(1 row)

lack@vhost:~$ psql -V
psql (PostgreSQL) 7.3.2
contains support for command-line editing
lack@vhost:~$

Collapse
7: Re: postgresql syntax (response to 6)
Posted by Darren Ferguson on
If you wanted to keep to the new Postgres standards that they are trying to achieve use the current_timestamp instead of now(). I believe they will be phasing now() out eventually

You can use it as follows for all 7.3.x releases

SELECT current_timestamp + '14 days'::INTERVAL from dual;

Unless current_timestamp is a field in the table dual though you could just do the following

SELECT current_timestamp + '14 days'::INTERVAL;

HTH