Received: from sss.sss.pgh.pa.us (sss.pgh.pa.us [209.114.166.2]) by hub.org (8.9.3/8.9.3) with ESMTP id UAA97691 for ; Mon, 16 Aug 1999 20:24:15 -0400 (EDT) (envelope-from tgl@sss.pgh.pa.us) Received: from sss.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.sss.pgh.pa.us (8.9.1/8.9.1) with ESMTP id UAA06513; Mon, 16 Aug 1999 20:23:31 -0400 (EDT) To: Nicolas Aragon cc: pgsql-interfaces@postgreSQL.org Subject: Re: [INTERFACES] types oids In-reply-to: Your message of Tue, 17 Aug 1999 01:18:35 +0200 <19990817011835.A165@atlante> Date: Mon, 16 Aug 1999 20:23:31 -0400 Message-ID: <6511.934849411@sss.pgh.pa.us> From: Tom Lane Nicolas Aragon writes: > But this leads me to new questions because it seems that standard types > aren't hardcoded anywhere. pg_type tells me the name, size and some other > information about the type. But what about the "kind" of the type (numeric, > text, date...)? You pretty much have to know from the name what the datatype is. Postgres doesn't have any type categorization like that. (Maybe it should ... I think there are some hacks in the parser that amount to categorizing the standard datatypes, but that knowledge is not visible outside the parser.) > I can only think of comparing the name with a list of names for standard > types. Is there another simpler method? A standard relation between standard > types and their OIDs? In reality, the OIDs assigned to standard types like "bool" and "int4" are unlikely ever to change; they certainly will not change faster than once per Postgres major release. You could probably get away with hard-wiring the knowledge that OID 16 == bool, say. If that seems a little too ugly, reading the OIDs for known types during startup is plenty good enough. If you are dealing with user-defined types, looking up the OIDs at startup is the way to go. (User type OIDs could change across a database dump/reload, so hardwiring those would be a bad idea.) > I can even think that.... is the user (admin) allowed to change the names > of standard types? Not if he wants things to keep working ;-) > Another, more trivial question: do you know where to find nice logos > for postgres? See the website. regards, tom lane