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