Обсуждение: data forma error in pgsql 7.1

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

data forma error in pgsql 7.1

От
"Ivan E. Rivera Uria"
Дата:
We are developing a Vehicle Control Application for Mexico Government
(Morelia, Michoacan), and we have a problem with the date format in the
database. The Operating System is RedHat Linux 7.2 and database is
PostgreSQL Ver.  7.1.3.

Explanation:

The comand that we execute is:

insert into docs_requeridos values
(243,5,15,1234567777,'01/11/2004','ivan',1);

the date format that we use is DD/MM/YYYY but whet we execute a select
command we get this information:

id  |status|id2|serie      |date_exe                |f_name |l_name
-------------------------------------------------------------------
243 |      5| 15|1234567777| 2004-01-11 00:00:00-06 |   ivan|1


Day and month are interchanged and this error happend only when the day
is less than 12, another error that occure is the year, in some cases
the year is inserted in this way, if the year is  2003, postgresql
inserts it like 0003.

We tested it with the to_char() function, but we have the same error in
the database.

Do you have some information about this problem???


We need to know if is necessary to install some patch to fix this
problem or upgrade the database.

regards



--
===============================================
Ivan E. Rivera Uria
BNC - Systems FPS Manager
Tel. +(52)-55-2614-0510
Fax. +(52)-55-
Email: irivera@bnchq.com.mx
Web: http://www.bnchq.com.mx
==============================================

Re: data forma error in pgsql 7.1

От
Tom Lane
Дата:
"Ivan E. Rivera Uria" <irivera@bnchq.com.mx> writes:
> the date format that we use is DD/MM/YYYY but whet we execute a select
> command we get this information:

Sounds to me like you haven't told the database what format you're
using.  See the DATESTYLE parameter; you need to select "european"
format to get it to default to dd-before-mm date order.

> We need to know if is necessary to install some patch to fix this
> problem or upgrade the database.

An upgrade would be a good idea in any case.  7.1.3 is pretty old.

            regards, tom lane

Re: data forma error in pgsql 7.1

От
"Ivan E. Rivera Uria"
Дата:
Tom you right!!

We only set PGDATESTYLE on root env and then restart the httpd

thanks

Tom Lane wrote:
> "Ivan E. Rivera Uria" <irivera@bnchq.com.mx> writes:
>
>>the date format that we use is DD/MM/YYYY but whet we execute a select
>>command we get this information:
>
>
> Sounds to me like you haven't told the database what format you're
> using.  See the DATESTYLE parameter; you need to select "european"
> format to get it to default to dd-before-mm date order.
>
>
>>We need to know if is necessary to install some patch to fix this
>>problem or upgrade the database.
>
>
> An upgrade would be a good idea in any case.  7.1.3 is pretty old.
>
>             regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if your
>       joining column's datatypes do not match
>

--
===============================================
Ivan E. Rivera Uria
BNC - Systems FPS Manager
Tel. +(52)-55-2614-0510
Fax. +(52)-55-
Email: irivera@bnchq.com.mx
Web: http://www.bnchq.com.mx
==============================================