TO_DATE function between PostgreSQL 8.2 and 9.4

Поиск
Список
Период
Сортировка
От gzh
Тема TO_DATE function between PostgreSQL 8.2 and 9.4
Дата
Msg-id 35162944.7eee.180d2badd7c.Coremail.gzhcoder@126.com
обсуждение исходный текст
Ответы Re: TO_DATE function between PostgreSQL 8.2 and 9.4  (Adrian Klaver <adrian.klaver@aklaver.com>)
Re: TO_DATE function between PostgreSQL 8.2 and 9.4  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: TO_DATE function between PostgreSQL 8.2 and 9.4  (John W Higgins <wishdev@gmail.com>)
Re: TO_DATE function between PostgreSQL 8.2 and 9.4  ("David G. Johnston" <david.g.johnston@gmail.com>)
Re: TO_DATE function between PostgreSQL 8.2 and 9.4  (Thomas Kellerer <shammat@gmx.net>)
Список pgsql-general

Hi,

 

I have had a Perl Website working for 7 years and have had no problems

until at the weekend I replace my database server with a newer one.

 

Database server (old): PostgreSQL 8.2 32bit

Database server (new): PostgreSQL 9.4 64bit

 

I run following sql in PostgreSQL 8.2, it return my expected result as ‘YYYY-MM-DD’ format.


--PostgreSQL 8.2

---------------

SELECT to_date(now() + '-7day', 'YYYY-MM-DD');


However after i migrated to PostgreSQL 9.4, i hit following error:


--PostgreSQL 9.4

---------------

SELECT to_date(now() + '-7day', 'YYYY-MM-DD');


--------------------------------------------------------------------------------

ERROR:  function to_date(timestamp with time zone, unknown) does not exist

LINE 1: SELECT to_date(now() + '-7day', 'YYYY-MM-DD')

                ^

********** Error **********


Of course, the most reliable way to deal with it is to 

rewrite the application or SQL to handle types strictly, 

but the application is large and rewrite is a terrible job. 


Is there any easy way to maintain compatibility?

 

Regards,

 

--

gzh




 

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

Предыдущее
От: Dan Lynch
Дата:
Сообщение: Postgres AST Deparser for Postgres
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: Restricting user to see schema structure