Re: Question on datatypes returned for "select oid, typname from pg_type"

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alexander Reichstadt <lxr(at)mac(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Question on datatypes returned for "select oid, typname from pg_type"
Date: 2012-03-09 20:15:19
Message-ID: 4836.1331324119@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Alexander Reichstadt <lxr(at)mac(dot)com> writes:
> to find out what datatypes exist. When checking on a certain field, it
> returned 17 as a type, thus being a bytea. That's actually the
> question now, because, is it always that bytea gets oid 17 or are
> these assignments of type name and oid dependent on the database
> installation, version of pg or whatever else I might be missing?

The built-in data types have hand-assigned OIDs, as depicted in
src/include/catalog/pg_type.h. While those aren't quite
guaranteed-frozen, we've never changed one that I can recall, and are
not very likely to in the future. However, any type that's not built-in
has an OID that will vary across databases. As a rule of thumb,
you could assume that any OID under 10000 is hand-assigned and won't
change.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Francisco Figueiredo Jr. 2012-03-09 20:40:42 Re: 9.1 causing "out of shared memory" error and higher serialization conflicts
Previous Message Randy Ficker 2012-03-09 20:12:29 Re: 9.1 causing "out of shared memory" error and higher serialization conflicts