pg.ddx.io pgsql-odbc@postgresql.org mailing list archive
help / color / mirror / Atom feedReport BUG: The column size for BIT VARYING(5) type is incorrect
3+ messages / 3 participants
[nested] [flat]
* Report BUG: The column size for BIT VARYING(5) type is incorrect
@ 2020-08-25 09:32 James (Ke) Wang <james.wang@sas.com>
0 siblings, 1 reply; 3+ messages in thread
From: James (Ke) Wang @ 2020-08-25 09:32 UTC (permalink / raw)
To: pgsql-odbc
l ODBC driver version
12.02.00.00
l PostgreSQL database version
PostgreSQL 11.4 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36), 64-bit
l Error message ( Log)
Successfully connected to DSN 'sbosmk'.
SQLExecDirect:
In: Statementhandle = 0x000000000060BD20, StatementText = "create table j_varbit2 (vbt1 bit varying (5))", Statementlength = 45
Return: SQL_SUCCESS=0
SQLPrepare:
In: StatementHandle = 0x000000000060BD20, StatementText = "select vbt1 from j_varbit2", TextLength = 26
Return: SQL_SUCCESS=0
SQLDescribeCol:
In:StatementHandle = 0x000000000060BD20, ColumnNumber = 1, ColumnName = 0x00000000001640D0, BufferLength = 600, NameLengthPtr = 0x0000000000104AA0, DataTypePtr = 0x000000000010DD30, ColumnSizePtr = 0x000000000010DD60, DecimalDigits = 0x000000000010DD90, NullablePtr = 0x000000000010DDC0
Return: SQL_SUCCESS=0
Out:*ColumnName = "vbt1", *NameLengthPtr = 4, *DataTypePtr = SQL_WVARCHAR=-9, *ColumnSizePtr = 1, *DecimalDigits = 0, *NullablePtr = SQL_NULLABLE=1
TST1011: Buffer ColumnName is not properly NULL terminated.
Note: Why is the *ColumnSizePtr = 1 instead of *ColumnSizePtr = 5 since the column is created with bit varying (5) in the test case?
Attachments:
mylog_odbct32w_2092.log (application/octet-stream, 4.7K) download
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Report BUG: The column size for BIT VARYING(5) type is incorrect
@ 2020-08-26 07:01 Clemens Ladisch <clemens@ladisch.de>
parent: James (Ke) Wang <james.wang@sas.com>
0 siblings, 1 reply; 3+ messages in thread
From: Clemens Ladisch @ 2020-08-26 07:01 UTC (permalink / raw)
To: pgsql-odbc@lists.postgresql.org
James (Ke) Wang wrote:
> create table j_varbit2 (vbt1 bit varying (5))
>
> *ColumnName = "vbt1", *NameLengthPtr = 4, *DataTypePtr = SQL_WVARCHAR=-9, *ColumnSizePtr = 1, *DecimalDigits = 0, *NullablePtr = SQL_NULLABLE=1
>
> Why is the *ColumnSizePtr = 1 instead of *ColumnSizePtr = 5 since the column is created with bit varying (5) in the test case?
The ODBC specification does not define the data type BIT VARYING, so the
ODBC driver tries to represent it as a blob or text.
And five bits fit into one byte.
Regards,
Clemens
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Report BUG: The column size for BIT VARYING(5) type is incorrect
@ 2020-08-27 14:42 Jon Raiford <raiford@labware.com>
parent: Clemens Ladisch <clemens@ladisch.de>
0 siblings, 0 replies; 3+ messages in thread
From: Jon Raiford @ 2020-08-27 14:42 UTC (permalink / raw)
To: Clemens Ladisch <clemens@ladisch.de>; +Cc: pgsql-odbc@lists.postgresql.org
"Clemens Ladisch" <clemens@ladisch.de> wrote on 08/26/2020 03:01:20 AM:
> > Why is the *ColumnSizePtr = 1 instead of *ColumnSizePtr = 5 since
> the column is created with bit varying (5) in the test case?
>
> The ODBC specification does not define the data type BIT VARYING, so the
> ODBC driver tries to represent it as a blob or text.
>
> And five bits fit into one byte.
I'm not sure this is the correct interpretation. According to PostgreSQL,
bit varying(n) is a bit "string" (
https://www.postgresql.org/docs/12/datatype-bit.html). The ODBC spec says
that the column size for all string types is defined as the "... maximum
column size in characters of the column or parameter" (
https://docs.microsoft.com/en-us/sql/odbc/reference/appendixes/column-size
). Also, according to the bug report, SQLDescribeCol answered that the
data type in this case was returned as SQL_WVARRCHAR.
I don't use this type myself but based on the documentation and the
(fact?) SQLDescribeCol answers the type as SQL_WVARCHAR, it does make
sense to me for the column size to match the number of characters needed
to represent the bits.
Jon
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2020-08-27 14:42 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-08-25 09:32 Report BUG: The column size for BIT VARYING(5) type is incorrect James (Ke) Wang <james.wang@sas.com>
2020-08-26 07:01 ` Re: Report BUG: The column size for BIT VARYING(5) type is incorrect Clemens Ladisch <clemens@ladisch.de>
2020-08-27 14:42 ` Re: Report BUG: The column size for BIT VARYING(5) type is incorrect Jon Raiford <raiford@labware.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox