Thread: Datetime and pgtypes.c

Datetime and pgtypes.c

From
"alexandre :: aldeia digital"
Date:
Mr. Hiroshi and all,

Sorry for report this bug again...The ODBC does not
convert 'datetime' type to 'timestamp without timezone'
for PostgreSQL 7.3
The MyLog output the correct version:
[2560]Extracted PostgreSQL version number: '7.3'

In pgtypes.c (annotate version), we have:


momjian  1.22                  case PG_TYPE_DATETIME:
hinoue  1.52                          if (PG_VERSION_GE(conn, 7.0))
hinoue  1.52                                  return "timestamp with time
zone";
hinoue  1.52                          else
hinoue  1.52                                  return "datetime";
inoue  1.47                  case PG_TYPE_TIMESTAMP_NO_TMZONE:
hinoue  1.52                          return "timestamp without time zone";


To correct this, I will need only to change the function
PG_VERSION_GE(conn, 7.3) or is a bug in the PG_VERSION_GE check
the GreatEqual version passed ???

Thank's again.




Re: Datetime and pgtypes.c

From
Hiroshi Inoue
Date:
alexandre :: aldeia digital wrote:
>
> Mr. Hiroshi and all,
>
> Sorry for report this bug again...The ODBC does not
> convert 'datetime' type to 'timestamp without timezone'
> for PostgreSQL 7.3

How do you convert the 'datetime' type concretely ?
Is the converted type still 'datetime' or 'timestamp with
time zone' ? Note that 'datetime' is never converted to
'timetstamp without time zone'.

regards,
Hiroshi Inoue
    http://w2422.nsk.ne.jp/~inoue/

Re: Datetime and pgtypes.c

From
"alexandre :: aldeia digital"
Date:
Hi,

First, the correct is ´timestamp with time zone´ and not
'timestamp without timezone'... Sorry.

I have a lot of CREATE scripts using ´datetime´
correctly in PG <= 7.2.3...PG convert automaticaly
to ´timestamp with time zone´.
But I can´t change the ´datetime´ in these scripts and
PG 7.3 remove this type.
If I send a "create foo (foo datetime)", PG 7.3 reports
´datetime´ does not exist. I only execute this statments
in win-odbc and not directly in psql.

Can ODBC convert automatically ´datetime´
to timestamp with time zone' or I have to create this type in PG 7.3
to convert it ?

Very thank´s, Mr. Hiroshi.


> alexandre :: aldeia digital wrote:
>>
>> Mr. Hiroshi and all,
>>
>> Sorry for report this bug again...The ODBC does not
>> convert 'datetime' type to 'timestamp without timezone'
>> for PostgreSQL 7.3
>
> How do you convert the 'datetime' type concretely ?
> Is the converted type still 'datetime' or 'timestamp with
> time zone' ? Note that 'datetime' is never converted to
> 'timetstamp without time zone'.
>
> regards,
> Hiroshi Inoue
>     http://w2422.nsk.ne.jp/~inoue/




Re: Datetime and pgtypes.c

From
Tom Lane
Date:
"alexandre :: aldeia digital" <alepaes@aldeiadigital.com.br> writes:
> I have a lot of CREATE scripts using �datetime�
> correctly in PG <= 7.2.3...PG convert automaticaly
> to �timestamp with time zone�.
> But I can�t change the �datetime� in these scripts and
> PG 7.3 remove this type.

If you can't afford the time to fix your scripts, you could use a DOMAIN
as a form of type alias:

regression=# create domain datetime timestamp with time zone;
CREATE DOMAIN
regression=# create table fooey (f1 datetime);
CREATE TABLE
regression=# select datetime('now');
           datetime
-------------------------------
 2002-12-03 09:44:46.458992-05
(1 row)

There might be some cases where this doesn't help, but I think it will
work for most of the common uses.

            regards, tom lane