From: gary.cowell@gmail.com
To: pgsql-bugs@postgresql.org
Subject: BUG #14460: ecpg dynamic describe data types incorrect
Date: Mon, 12 Dec 2016 15:36:03 +0000
Message-ID: <20161212153603.14901.48046@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
The following bug has been logged on the website:
Bug reference: 14460
Logged by: gary surname
Email address: gary.cowell@gmail.com
PostgreSQL version: 9.5.5
Operating system: Red Hat Linux 7
Description:
If you have a table:
gc=> \d tajsplne
Table "public.tajsplne"
Column | Type | Modifiers
--------+-----------------------+-----------
a | character varying(20) |
b | text |
c | character(10) |
d | integer |
four different data types.
Insert a row:
gc=> insert into tajsplne values ('var','text','char',1);
INSERT 0 1
gc=> \q
Then run an ecpg program to select and describe the data, the data types
come back as:
a = var (type: 1)
b = text (type: 1)
c = char (type: 1)
d = 1 (type: 5)
I.e. the sqlda data types for the CHAR , VARCHAR and TEXT columns, is all
type 1.
According to ecpgtype.h
enum ECPGttype
{
ECPGt_char = 1, ECPGt_unsigned_char, ECPGt_short,
ECPGt_unsigned_short,
ECPGt_int, ECPGt_unsigned_int, ECPGt_long, ECPGt_unsigned_long,
ECPGt_long_long, ECPGt_unsigned_long_long,
ECPGt_bool,
ECPGt_float, ECPGt_double,
ECPGt_varchar, ECPGt_varchar2,
ECPGt_numeric, /* this is a decimal that
stores its digits in
* a
malloced array */
ECPGt_decimal, /* this is a decimal that
stores its digits in
* a fixed
array */
ECPGt_date,
ECPGt_timestamp,
ECPGt_interval,
ECPGt_array,
ECPGt_struct,
ECPGt_union,
ECPGt_descriptor, /* sql descriptor, no C
variable */
ECPGt_char_variable,
ECPGt_const, /* a constant is needed
sometimes */
ECPGt_EOIT, /* End of insert
types. */
ECPGt_EORT, /* End of result
types. */
ECPGt_NO_INDICATOR, /* no indicator */
ECPGt_string, /* trimmed (char *) type
*/
ECPGt_sqlda /* C struct
descriptor */
};
the varchar at least should be type 14, yes? Though not much clue what the
TEXT type should be.
Have I a misunderstanding, or is this a bug?
Thanks
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
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-bugs@postgresql.org
Cc: gary.cowell@gmail.com
Subject: Re: BUG #14460: ecpg dynamic describe data types incorrect
In-Reply-To: <20161212153603.14901.48046@wrigleys.postgresql.org>
References: <20161212153603.14901.48046@wrigleys.postgresql.org>
* 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