Обсуждение: Bug #696: timestamp function does not work?

Поиск
Список
Период
Сортировка

Bug #696: timestamp function does not work?

От
pgsql-bugs@postgresql.org
Дата:
Sandor, Vig (sandor.vig@audi.hu) reports a bug with a severity of 2
The lower the number the more severe it is.

Short Description
timestamp function does not work?

Long Description
I've wrote an application under PHP, wich uses Postgres 7.1.
After I installed the new RedHat 7.3 with Postgres 7.2 some of my
SQLs didn't worked. Mainly thoose, with the timestamp function:

  timestamp(current_date, current_time)

does work under 7.1 but under 7.2 there is an parser error!
Why?

Sample Code
select current_date; O.K.
select current_time; O.K.
select current_timestamp; O.K.
select timestamp(current_date, current_time); Works only under 7.1!!!!

No file was uploaded with this report

Re: Bug #696: timestamp function does not work?

От
Thomas Lockhart
Дата:
>   timestamp(current_date, current_time)
> does work under 7.1 but under 7.2 there is an parser error!

Please check the release notes and the SQL standard for why you can not
call a function timestamp() directly; the syntax is now reserved for
specifying a data type, not a function call.

For this particular case, you should be using the SQL-standard
CURRENT_TIMESTAMP.

You can convert date, time to timestamp by casting date to timestamp and
then adding the time.

                    - Thomas

Re: Bug #696: timestamp function does not work?

От
Tom Lane
Дата:
pgsql-bugs@postgresql.org writes:
> After I installed the new RedHat 7.3 with Postgres 7.2 some of my
> SQLs didn't worked. Mainly thoose, with the timestamp function:
>   timestamp(current_date, current_time)
> does work under 7.1 but under 7.2 there is an parser error!

You're gonna have to rename the function.  Sorry.

(Actually, you could double quote it instead: "timestamp"(foo,bar)
but the path of least resistance is to choose a name that is not
an SQL reserved word.)

            regards, tom lane