pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jacobo Sánchez <jsanchez@denodo.com>
To: pgsql-odbc@postgresql.org
Subject: Question about SQLColumns results on VARCHAR types
Date: Thu, 12 Jan 2017 10:12:56 +0100
Message-ID: <0aa10fc0-9de9-2af0-445d-35ae5d109bc0@denodo.com> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-odbc>

Hello

     I have a question about metadata exposed using SQLColumns function. 
I have created the following table in PostgresSQL:

CREATE TABLE testvarchar (vc2000 varchar(*2000*), vc500 varchar(*500*))

Then i configure a DSN (tested versions 9.3.400 and 9.5.400) and execute 
SQLColumns for the previous table getting the following results:

"TABLE_QUALIFIER", "TABLE_OWNER", "TABLE_NAME", "COLUMN_NAME", 
"DATA_TYPE", "TYPE_NAME", "PRECISION", "LENGTH", "SCALE", "RADIX", 
"NULLABLE", "REMARKS", "COLUMN_DEF", "SQL_DATA_TYPE", 
"SQL_DATETIME_SUB", "CHAR_OCTET_LENGTH", "ORDINAL_POSITION", 
"IS_NULLABLE", "DISPLAY_SIZE", "FIELD_TYPE", "AUTO_INCREMENT", "PHYSICAL 
NUMBER", "TABLE OID", "BASE TYPEID", "TYPMOD"

*ANSI with MaxVarchar 500:*

"xxx", "xxx", "testvarchar", "vc2000", -1, "varchar", 2000, 6000, 
<Null>, <Null>, 1, "", <Null>, -1, <Null>, 6000, 1, <Null>, 2000, 1043, 
0, 1, 46594, 0, 2000
"xxx", "xxx", "testvarchar", "vc500", 12, "varchar", 500, 500, <Null>, 
<Null>, 1, "", <Null>, 12, <Null>, 500, 2, <Null>, 500, 1043, 0, 2, 
46594, 0, 500

*ANSI with MaxVarchar 2000*

"xxx", "xxx", "testvarchar", "vc2000", 12, "varchar", 2000, 2000, 
<Null>, <Null>, 1, "", <Null>, 12, <Null>, 2000, 1, <Null>, 2000, 1043, 
0, 1, 46594, 0, 2000
"xxx", "xxx", "testvarchar", "vc500", 12, "varchar", 500, 1500, <Null>, 
<Null>, 1, "", <Null>, 12, <Null>, 1500, 2, <Null>, 500, 1043, 0, 2, 
46594, 0, 500

*UNICODE with MaxVarchar 500*

"xxx", "xxx", "testvarchar", "vc2000", *-10*, "varchar", 2000, 4000, 
<Null>, <Null>, 1, "", <Null>, -10, <Null>, 4000, 1, <Null>, 2000, 1043, 
0, 1, 46594, 0, 2000
"xxx", "xxx", "testvarchar", "vc500", -9, "varchar", 500, 1000, <Null>, 
<Null>, 1, "", <Null>, -9, <Null>, 1000, 2, <Null>, 500, 1043, 0, 2, 
46594, 0, 500

*UNICODE with MaxVarchar 2000*

"xxx", "xxx", "testvarchar", "vc2000", -9, "varchar", 2000, 4000, 
<Null>, <Null>, 1, "", <Null>, -9, <Null>, 4000, 1, <Null>, 2000, 1043, 
0, 1, 46594, 0, 2000
"xxx", "xxx", "testvarchar", "vc500", -9, "varchar", 500, 1000, <Null>, 
<Null>, 1, "", <Null>, -9, <Null>, 1000, 2, <Null>, 500, 1043, 0, 2, 
46594, 0, 500


I do not understand very well the variation between precision and length 
but my real question comes on DATA_TYPES. What i see is that using a 
MaxVarchar configuration for less than the varchar declared size it 
changes from VARCHAR (12) to LONGVARCHAR(-1). However using the UNICODE 
it comes from NVARCHAR(-9) to a code -10 which i can not find what 
really means. I expected to see -16? for LONGNVARCHAR.

So what does -10 points to? and where can i find the mapping for it?


Regards, Jacobo

view thread (2+ messages)  latest in thread

Message-ID: <0aa10fc0-9de9-2af0-445d-35ae5d109bc0@denodo.com>
Permalink:  ../0aa10fc0-9de9-2af0-445d-35ae5d109bc0@denodo.com/
Also on:    postgresql.org/message-id/0aa10fc0-9de9-2af0-445d-35ae5d109bc0@denodo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-odbc@postgresql.org
  Cc: jsanchez@denodo.com
  Subject: Re: Question about SQLColumns results on VARCHAR types
  In-Reply-To: <0aa10fc0-9de9-2af0-445d-35ae5d109bc0@denodo.com>
  References: <0aa10fc0-9de9-2af0-445d-35ae5d109bc0@denodo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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