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

From: Naoya Anzai <nao-anzai(at)xc(dot)jp(dot)nec(dot)com>
To: "Inoue, Hiroshi" <h-inoue(at)dream(dot)email(dot)ne(dot)jp>
Cc: "pgsql-odbc(at)postgresql(dot)org" <pgsql-odbc(at)postgresql(dot)org>, "Hiroshi Yanagisawa" <hir-yanagisawa(at)ut(dot)jp(dot)nec(dot)com>
Subject: Re: [BUGS] There is a case in which psqlodbc-09.03.0400 returns unterminated strings on Windows.
Date: 2015-11-11 03:49:53
Message-ID: 116262CF971C844FB6E793F8809B51C6F24213@BPXM02GP.gisp.nec.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)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(at)xc(dot)jp(dot)nec(dot)com
---

In response to

Browse pgsql-odbc by date

  From Date Subject
Next Message Inoue, Hiroshi 2015-11-11 11:24:12 Re: SQL_DATA_AT_EXEC processing broken for large objects in nightly git
Previous Message Lindsay Stevens 2015-11-11 00:09:33 Re: Let's make a new release