Re: [BUGS] There is a case in which psqlodbc-09.03.0400 returns unterminated strings on Windows. - Mailing list pgsql-odbc

From Naoya Anzai
Subject Re: [BUGS] There is a case in which psqlodbc-09.03.0400 returns unterminated strings on Windows.
Date
Msg-id 116262CF971C844FB6E793F8809B51C6F24213@BPXM02GP.gisp.nec.co.jp
Whole thread Raw
In response to Re: [BUGS] There is a case in which psqlodbc-09.03.0400 returns unterminated strings on Windows.  ("Inoue, Hiroshi" <h-inoue@dream.email.ne.jp>)
List pgsql-odbc
Inoue-san

> Oops it was my mistake.
> I would take care of it.
> BTW why is the last parameter 6?

MAX_TIMESTAMP_PRECISION(a macro in timestamp.h(PostgreSQL)) is always 6.
--- src/include/utils/timestamp.h
#define MAX_TIMESTAMP_PRECISION 6
---

I have confirmed that this specification is not changed from PostgreSQL7.3.

MAX_TIME_PRECISION can be changed 6 to 10 with --disable-integer-datetimes,
but this precision is used by TIME data type only.

---
[naoya@nesitcspg03 ~]$ psql
psql (9.5beta1)
Type "help" for help.

[local] 32289 naoya=# select '2015-11-11 11:11:11.123456789'::time(10);
        time        
--------------------
 11:11:11.123456789
(1 row)

[local] 32289 naoya=# select '2015-11-11 11:11:11.123456789'::time(10) with time zone;
        timetz         
-----------------------
 11:11:11.123456789+09
(1 row)

[local] 32289 naoya=# select '2015-11-11 11:11:11.123456789'::timestamp(10);
WARNING:  TIMESTAMP(10) precision reduced to maximum allowed, 6 at character 41
WARNING:  TIMESTAMP(10) precision reduced to maximum allowed, 6
LINE 1: select '2015-11-11 11:11:11.123456789'::timestamp(10);
                                                ^
         timestamp          
----------------------------
 2015-11-11 11:11:11.123457
(1 row)

[local] 32289 naoya=# select '2015-11-11 11:11:11.123456789'::timestamp(10) with time zone;
WARNING:  TIMESTAMP(10) WITH TIME ZONE precision reduced to maximum allowed, 6 at character 41
WARNING:  TIMESTAMP(10) WITH TIME ZONE precision reduced to maximum allowed, 6
LINE 1: select '2015-11-11 11:11:11.123456789'::timestamp(10) with t...
                                                ^
          timestamptz          
-------------------------------
 2015-11-11 11:11:11.123457+09
(1 row)

[local] 32289 naoya=# select '11.123456789'::interval(10);
WARNING:  INTERVAL(10) precision reduced to maximum allowed, 6 at character 24
WARNING:  INTERVAL(10) precision reduced to maximum allowed, 6
LINE 1: select '11.123456789'::interval(10);
                               ^
    interval     
-----------------
 00:00:11.123457
(1 row)
---

> >> --- C:/work/psqlodbc-a2def3d/convert.c.orig    Wed Sep 23 16:14:10 2015
> >> +++ C:/work/psqlodbc-a2def3d/convert.c    Thu Sep 24 09:01:50 2015
> >> @@ -1247,8 +1247,7 @@
> >>               case PG_TYPE_TIMESTAMP:
> >>                   /* sprintf(rgbValueBindRow, "%.4d-%.2d-%.2d %.2d:%.2d:%.2d",
> >>                       std_time.y, std_time.m, std_time.d, std_time.hh, std_time.mm, std_time.ss);
> >> */
> >> -                len = stime2timestamp(&std_time, rgbValueBindRow, cbValueMax, FALSE,
> >> -                                      (int) (cbValueMax - len - 2) );
> >> +                len = stime2timestamp(&std_time, rgbValueBindRow, cbValueMax, FALSE, 6 );
> >>                   if (len + 1 > cbValueMax)
> >>                       result = COPY_RESULT_TRUNCATED;
> >>                   break;

Regards,

Naoya

---
Naoya Anzai
Engineering Department
NEC Solution Inovetors, Ltd.
E-Mail: nao-anzai@xc.jp.nec.com
---


pgsql-odbc by date:

Previous
From: Lindsay Stevens
Date:
Subject: Re: Let's make a new release
Next
From: "Inoue, Hiroshi"
Date:
Subject: Re: SQL_DATA_AT_EXEC processing broken for large objects in nightly git