Re: [HACKERS] pg_type questions - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: [HACKERS] pg_type questions
Date
Msg-id Pine.LNX.4.10.9910172224310.366-100000@peter-e.yi.org
Whole thread Raw
In response to Re: [HACKERS] pg_type questions  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Oct 17, Tom Lane mentioned:

> For the standard system types like int4, text, etc, it's probably OK
> for client code to assume that particular numeric OIDs correspond to
> those types --- use the #defines that are in catalog/pg_type.h, such as
> BOOLOID, to refer to those types.  (I think there are one or two places
> in libpq and/or psql that do this already, eg, to decide whether a
> column is "numeric".)  The backend does this all over the place, but
> it's a little shakier for frontend code to do it, because a frontend
> might possibly be used with other database versions than the one it was
> compiled for.  Still, I think you could get away with it for standard
> types --- AFAIK no one has any intention of renumbering those.
> 
> (Thomas has been muttering dire things about the date/time types, so
> you might be well advised not to assume anything about those ;-).)

The previous alignment "algorithm" in psql in essence checked for
[^-+0-9\.eE] or sth like that as far as I could tell.

Right now I am just aligning int[248], float[48], and numeric but the
date/time types might be nice as well. But the idea was to straighten this
out a bit so that alignment for other datatypes could easily be added or
removed. I think I might have accomplished that ;)
-Peter

-- 
Peter Eisentraut                  Sernanders vaeg 10:115
peter_e@gmx.net                   75262 Uppsala
http://yi.org/peter-e/            Sweden



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] sort on huge table
Next
From: Peter Eisentraut
Date:
Subject: Re: ORACLE COMMENT statement