From: | Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)nz> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Alexander Reichstadt <lxr(at)mac(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Question on datatypes returned for "select oid, typname from pg_type" |
Date: | 2012-03-09 21:00:19 |
Message-ID: | 4F5A6F63.2060807@archidevsys.co.nz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 10/03/12 09:15, Tom Lane wrote:
> 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
>
Hmm...
That kind of reasoning makes me nervous!
What if some developer wants to change the OIDs assigned for some
reason, and is blissfully unaware that people depend on those precise
values?
I once did a minor cosmetic change to a report program on a mainframe. A
few weeks later a user area complained their SAS program was generating
errors. Turns out they were processing the print file & my added spaces
caused them grief. Admittedly, it could be argued that people should not
be feeding print files into programs like that.
Essentially, if people are relying on specific values, I think those
values should be documented appropriately, and the associated program
code should reflect possible usage elsewhere. How best to achieve that
in this example, I don't know. Possibly a simple comment where the
numbers are assigned plus documentation in the manual (I've a vague idea
this might already have been done).
I guess the main trigger for me is the idea that they have not changed
for a long time and unlikely to be, and similar reasoning.
Cheers,
Gavin
P.S. Hopes no one looks at the cruddy code I'm writing...
or maybe they should,
and then I could correct silly assumptions,
before they bite me further down the track... :-)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2012-03-09 21:04:10 | Re: Question on datatypes returned for "select oid, typname from pg_type" |
Previous Message | Francisco Figueiredo Jr. | 2012-03-09 20:40:42 | Re: 9.1 causing "out of shared memory" error and higher serialization conflicts |