v7.0.2: can't use 'EXTRACT(EPOCH FROM'

Started by Trevin Chowover 24 years ago3 messagesbugs
Jump to latest
#1Trevin Chow
tmchow@sfu.ca

I'm running postgres 7.0.3 on one machine and 7.1.2 on another. I tried
running the exact SQL sample from the user manual for date time
functions:

SELECT EXTRACT(EPOCH FROM TIMESTAMP '2001-02-16 20:38:40');

This example won't run on the v7.0.3 and I get teh following error:

ERROR: parser: parse error at or near "epoch"

However, the same SQL sample runs on v7.1.2. Am I doing something wrong
here? Is this a known bug?

#2Peter Eisentraut
peter_e@gmx.net
In reply to: Trevin Chow (#1)
Re: v7.0.2: can't use 'EXTRACT(EPOCH FROM'

Trevin Chow writes:

However, the same SQL sample runs on v7.1.2. Am I doing something wrong
here? Is this a known bug?

No, it simply didn't exist back then.

--
Peter Eisentraut peter_e@gmx.net http://funkturm.homeip.net/~peter

#3Thomas Lockhart
lockhart@fourpalms.org
In reply to: Trevin Chow (#1)
Re: v7.0.2: can't use 'EXTRACT(EPOCH FROM'

SELECT EXTRACT(EPOCH FROM TIMESTAMP '2001-02-16 20:38:40');
This example won't run on the v7.0.3...
However, the same SQL sample runs on v7.1.2. Am I doing something wrong
here? Is this a known bug?

For versions prior to 7.1 (and for current versions also), try

SELECT EXTRACT('epoch' FROM TIMESTAMP '2001-02-16 20:38:40');

(note the single quotes around "epoch"). 7.1.x also allows the
non-quoted form you gave as an example.

- Thomas