[Raiford@labware.com: Re: float8 column size defined as 15 instead of 53?]

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

[Raiford@labware.com: Re: float8 column size defined as 15 instead of 53?]

От:
Alvaro Herrera <alvherre@alvh.no-ip.org>
Дата:
----- Forwarded message from Raiford@labware.com -----

Date: Tue, 19 Jan 2016 17:12:33 -0700
From: Raiford@labware.com
To: pgsql-odbc-owner@postgresql.org
Subject: Re: float8 column size defined as 15 instead of 53?
Message-ID: 

So I am finding conflicting information about this value.  The 
documentation for Column Size (
https://msdn.microsoft.com/en-us/library/ms711786%28v=vs.85%29.aspx) shows 
the value being the decimal precision.  I know from experience that I can 
get binary precision from SQL Server and from Oracle, so maybe there is 
something else going on that I don't understand.

I did look at the code for the pgsql-odbc driver and in 
pgtype_attr_column_size() the driver is answering 15 for float8 in the 
older driver that I am using.  In the current driver it is answering 17. 
Now I'm even more confused!  Surely there can only be 15 digits of decimal 
precision in a IEEE double floating point?  Is Postgres somehow able to 
include 17 digits precision if requesting the value as text (9 for single 
precision floats)?  In the current driver these values are from 
PG_REAL_DIGITS and PG_DOUBLE_DIGITS.  In the older driver they were simply 
hard coded.

Can anyone shed some light on this stuff?  Clearly there is something I'm 
missing.

Jon



From:   Jon Raiford/Employee/LW-US
To:     pgsql-odbc-owner@postgresql.org
Date:   01/19/2016 12:27 PM
Subject:        float8 column size defined as 15 instead of 53?


I'm seeing that the columns defined as float8 in Postgres are being 
described as SQL_FLOAT(15) instead of SQL_FLOAT(53).  From what I can 
tell, according to the ODBC spec, the column size should be reported as 
binary precision, but the Postgres ODBC driver is reporting the decimal 
precision.

https://msdn.microsoft.com/en-us/library/ms710150%28v=vs.85%29.aspx

"SQL_FLOAT  FLOAT(p)  Signed, approximate, numeric value with a binary 
precision of at least p. (The maximum precision is driver-defined.)[5]"

Unfortunately I'm not running on a current ODBC driver and it would be 
very inconvenient for me to load it at this moment.  Could someone with 
the latest driver verify whether or not SQLDescribeCol(), 
SQLGetTypeInfo(), or SQLColAttribute() still report this with the decimal 
precision?

I am happy to add a kludge to my code to treat numbers <= 15 as decimal 
precision, but at some point it would be nice to see this be fixed if it 
hasn't already.

I'm currently running the PostgreSQL Unicode 9.01.01.00 driver from 
30-Dec-2011.  I know it is quite old, so I'd be happy to hear that this is 
already resolved.  I'd also be happy to hear that I've misunderstood the 
spec and would love clarification.  For what its worth, I do see that both 
SQL Server and Oracle are reporting binary precision.

Thank you,
Jon

www.labware.com
Results Count






www.labware.com
Results Count




----- End forwarded message -----


Re: [Raiford@labware.com: Re: float8 column size defined as 15 instead of 53?]

От:
Raiford@labware.com
Дата:
A big thank you to Alvaro for forwarding my previous emails to the list.  I'm not sure why I sent them to the owner list.

For my issue, I was able to find the missing piece of information - NUM_PREC_RADIX.  This is either 2 or 10 and is what I should be using to understand if the COLUMN_SIZE argument is decimal or binary.

Jon



From:        Alvaro Herrera <alvherre@alvh.no-ip.org>
To:        pgsql-odbc@postgresql.org
Date:        01/19/2016 05:28 PM
Subject:        [ODBC] [Raiford@labware.com: Re: float8 column size defined as 15 instead of 53?]
Sent by:        pgsql-odbc-owner@postgresql.org




----- Forwarded message from Raiford@labware.com -----

Date: Tue, 19 Jan 2016 17:12:33 -0700
From: Raiford@labware.com
To: pgsql-odbc-owner@postgresql.org
Subject: Re: float8 column size defined as 15 instead of 53?
Message-ID: <OFB569ED94.0C1AE84E-ON85257F40.00006986-87257F40.0000B402@labware.com>

So I am finding conflicting information about this value.  The
documentation for Column Size (
https://msdn.microsoft.com/en-us/library/ms711786%28v=vs.85%29.aspx) shows
the value being the decimal precision.  I know from experience that I can
get binary precision from SQL Server and from Oracle, so maybe there is
something else going on that I don't understand.

I did look at the code for the pgsql-odbc driver and in
pgtype_attr_column_size() the driver is answering 15 for float8 in the
older driver that I am using.  In the current driver it is answering 17.
Now I'm even more confused!  Surely there can only be 15 digits of decimal
precision in a IEEE double floating point?  Is Postgres somehow able to
include 17 digits precision if requesting the value as text (9 for single
precision floats)?  In the current driver these values are from
PG_REAL_DIGITS and PG_DOUBLE_DIGITS.  In the older driver they were simply
hard coded.

Can anyone shed some light on this stuff?  Clearly there is something I'm
missing.

Jon



From:   Jon Raiford/Employee/LW-US
To:     pgsql-odbc-owner@postgresql.org
Date:   01/19/2016 12:27 PM
Subject:        float8 column size defined as 15 instead of 53?


I'm seeing that the columns defined as float8 in Postgres are being
described as SQL_FLOAT(15) instead of SQL_FLOAT(53).  From what I can
tell, according to the ODBC spec, the column size should be reported as
binary precision, but the Postgres ODBC driver is reporting the decimal
precision.

https://msdn.microsoft.com/en-us/library/ms710150%28v=vs.85%29.aspx

"SQL_FLOAT  FLOAT(p)  Signed, approximate, numeric value with a binary
precision of at least p. (The maximum precision is driver-defined.)[5]"

Unfortunately I'm not running on a current ODBC driver and it would be
very inconvenient for me to load it at this moment.  Could someone with
the latest driver verify whether or not SQLDescribeCol(),
SQLGetTypeInfo(), or SQLColAttribute() still report this with the decimal
precision?

I am happy to add a kludge to my code to treat numbers <= 15 as decimal
precision, but at some point it would be nice to see this be fixed if it
hasn't already.

I'm currently running the PostgreSQL Unicode 9.01.01.00 driver from
30-Dec-2011.  I know it is quite old, so I'd be happy to hear that this is
already resolved.  I'd also be happy to hear that I've misunderstood the
spec and would love clarification.  For what its worth, I do see that both
SQL Server and Oracle are reporting binary precision.

Thank you,
Jon

www.labware.com
Results Count






www.labware.com
Results Count




----- End forwarded message -----



--
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc



www.labware.com
Results Count



FAQ