pg.ddx.io pgsql-interfaces@postgresql.org mailing list archive
help / color / mirror / Atom feedrow description, protocol 3
5+ messages / 3 participants
[nested] [flat]
* row description, protocol 3
@ 2006-02-28 05:53 Josh Close <narshe@gmail.com>
2006-02-28 06:10 ` Re: row description, protocol 3 John DeSoi <desoi@pgedit.com>
0 siblings, 1 reply; 5+ messages in thread
From: Josh Close @ 2006-02-28 05:53 UTC (permalink / raw)
To: pgsql-interfaces
I'm getting row description and row data back from Postgres, but I can't
figure out how to get the datatype of the row field.
There is a type modifier and an oid of a the field's data type, but I
haven't found anywhere those match up with Postgres data types.
Where can I get the data type from the row description?
-Josh
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: row description, protocol 3
2006-02-28 05:53 row description, protocol 3 Josh Close <narshe@gmail.com>
@ 2006-02-28 06:10 ` John DeSoi <desoi@pgedit.com>
2006-02-28 06:42 ` Re: row description, protocol 3 Tom Lane <tgl@sss.pgh.pa.us>
2006-03-01 01:13 ` Re: row description, protocol 3 Josh Close <narshe@gmail.com>
0 siblings, 2 replies; 5+ messages in thread
From: John DeSoi @ 2006-02-28 06:10 UTC (permalink / raw)
To: Josh Close <narshe@gmail.com>; +Cc: pgsql-interfaces
Johsh,
On Feb 28, 2006, at 12:53 AM, Josh Close wrote:
> I'm getting row description and row data back from Postgres, but I
> can't figure out how to get the datatype of the row field.
>
> There is a type modifier and an oid of a the field's data type, but
> I haven't found anywhere those match up with Postgres data types.
>
> Where can I get the data type from the row description?
The oid maps to the pg_type table:
select oid, typname from pg_type order by oid;
John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: row description, protocol 3
2006-02-28 05:53 row description, protocol 3 Josh Close <narshe@gmail.com>
2006-02-28 06:10 ` Re: row description, protocol 3 John DeSoi <desoi@pgedit.com>
@ 2006-02-28 06:42 ` Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 0 replies; 5+ messages in thread
From: Tom Lane @ 2006-02-28 06:42 UTC (permalink / raw)
To: John DeSoi <desoi@pgedit.com>; +Cc: Josh Close <narshe@gmail.com>; pgsql-interfaces
John DeSoi <desoi@pgedit.com> writes:
> On Feb 28, 2006, at 12:53 AM, Josh Close wrote:
>> Where can I get the data type from the row description?
> The oid maps to the pg_type table:
> select oid, typname from pg_type order by oid;
Also, the format_type function might be useful:
regression=# select format_type(1042, 44);
format_type
---------------
character(40)
(1 row)
regards, tom lane
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: row description, protocol 3
2006-02-28 05:53 row description, protocol 3 Josh Close <narshe@gmail.com>
2006-02-28 06:10 ` Re: row description, protocol 3 John DeSoi <desoi@pgedit.com>
@ 2006-03-01 01:13 ` Josh Close <narshe@gmail.com>
2006-03-01 13:01 ` Re: row description, protocol 3 John DeSoi <desoi@pgedit.com>
1 sibling, 1 reply; 5+ messages in thread
From: Josh Close @ 2006-03-01 01:13 UTC (permalink / raw)
To: John DeSoi <desoi@pgedit.com>; +Cc: pgsql-interfaces
>
> The oid maps to the pg_type table:
>
> select oid, typname from pg_type order by oid;
>
So, after a select is done, and I get a row description back, I need to do
another query to find out what the actual type was?
I'm writing a dataprovider, so I need to map the types back to .NET types.
It seems kinda odd that you'd have to do a second query to find out the
type.
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: row description, protocol 3
2006-02-28 05:53 row description, protocol 3 Josh Close <narshe@gmail.com>
2006-02-28 06:10 ` Re: row description, protocol 3 John DeSoi <desoi@pgedit.com>
2006-03-01 01:13 ` Re: row description, protocol 3 Josh Close <narshe@gmail.com>
@ 2006-03-01 13:01 ` John DeSoi <desoi@pgedit.com>
0 siblings, 0 replies; 5+ messages in thread
From: John DeSoi @ 2006-03-01 13:01 UTC (permalink / raw)
To: Josh Close <narshe@gmail.com>; +Cc: pgsql-interfaces
On Feb 28, 2006, at 8:13 PM, Josh Close wrote:
> So, after a select is done, and I get a row description back, I
> need to do another query to find out what the actual type was?
>
> I'm writing a dataprovider, so I need to map the types back to .NET
> types. It seems kinda odd that you'd have to do a second query to
> find out the type.
The majority will correspond to fixed types in PostgreSQL. I just
used this type list to build a program that parses the data into the
native type of the application. Or if you just need to know the name
of the type, build some kind of lookup table in the application. You
could also do the lookup once and then cache the result.
John
John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2006-03-01 13:01 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-02-28 05:53 row description, protocol 3 Josh Close <narshe@gmail.com>
2006-02-28 06:10 ` John DeSoi <desoi@pgedit.com>
2006-02-28 06:42 ` Tom Lane <tgl@sss.pgh.pa.us>
2006-03-01 01:13 ` Josh Close <narshe@gmail.com>
2006-03-01 13:01 ` John DeSoi <desoi@pgedit.com>
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