Discussion:
data type
(too old to reply)
Ashok Chauhan
2003-12-31 16:53:13 UTC
Permalink
hello

how i recognize the data type of any field
except \d table_name;

there is a function of libpq library for recognize field type
but it returns a number not a name of the data type so how i know the
name with the help of this number.

recv_interger_number = PQftype(resultant_pointer,field_number);

And this number is same in all versions of postgresql.
suppose:-
in version 7.2 1043 for character & 1083 for varchar so
in version 7.3 is same or not.

Because my requirement is the data type name in string form not in
number's form.

plz. help me
thanks
Ashok



---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org
Chris Travers
2003-12-31 12:31:29 UTC
Permalink
Hi Ashok;

Check the documentation on the system catalogs. You can look up types
there, etc. using joins from the system catalogs.

Something like
SELECT typname FROM pg_types WHERE oid IN (SELECT atttypid FROM pg_attribute
WHERE attname = 'column_name' AND attrelid = (SELECT oid FROM pg_class WHERE
relname = 'table_name'));

Of course that is just off the top of my head, so don't count on it working.
Check the developers' docs for the system catalog documentation.

Best Wishes,
Chris Traver
----- Original Message -----
From: "Ashok Chauhan" <***@kalculate.com>
To: <pgsql-***@postgresql.org>
Sent: Wednesday, December 31, 2003 11:53 PM
Subject: [ADMIN] data type
Post by Ashok Chauhan
hello
how i recognize the data type of any field
except \d table_name;
there is a function of libpq library for recognize field type
but it returns a number not a name of the data type so how i know the
name with the help of this number.
recv_interger_number = PQftype(resultant_pointer,field_number);
And this number is same in all versions of postgresql.
suppose:-
in version 7.2 1043 for character & 1083 for varchar so
in version 7.3 is same or not.
Because my requirement is the data type name in string form not in
number's form.
plz. help me
thanks
Ashok
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?
http://archives.postgresql.org
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Loading...