Thread: New system OIDS inside include/catalog/pg_proc.h

New system OIDS inside include/catalog/pg_proc.h

From
"Greg Sabino Mullane"
Date:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I am in the process of adding some external interfaces to the temporary 
relations (started as a goal of being able to view temporary 
tables in psql with \d). How do I choose a new OID when adding something 
to include/catalog/pg_proc.h? The comments say to "keep the following 
ordered by OID" and then "OIDS 1 - 99" but then we jump right into 
OIDs 1242,1243,1244,31,1245, etc. What are the guidelines for choosing a 
new number when creating (for example) a pg_tempname() function?

Thanks,
Greg Sabino Mullane greg@turnstep.com
PGP Key: 0x14964AC8 200201251014

-----BEGIN PGP SIGNATURE-----
Comment: http://www.turnstep.com/pgp.html

iD8DBQE8UXiwvJuQZxSWSsgRAkmqAJ4zrgtNILaqjcCcGxRWc9ab4q3WfwCg0zjD
+c2X3pa13Z1QF4+keJQFs3U=
=2Nan
-----END PGP SIGNATURE-----




Re: New system OIDS inside include/catalog/pg_proc.h

From
Peter Eisentraut
Date:
Greg Sabino Mullane writes:

> What are the guidelines for choosing a
> new number when creating (for example) a pg_tempname() function?

Just pick the first one that's available.

~/pgsql/src/include/catalog$ ./unused_oids
3 - 11
90
99
109 - 111
143
652
1076 - 1077
2019
2071 - 9999

Maybe the single-digits should stay reserved for some truly important
objects or magic use, but for any old functionI'd start at 90, or if you
make a group of three functions use 109-111, or if you make a group of 25
objects, start at 2071.  In short, it doesn't matter, but try to make a
little sense.

-- 
Peter Eisentraut   peter_e@gmx.net



Re: New system OIDS inside include/catalog/pg_proc.h

From
Tom Lane
Date:
"Greg Sabino Mullane" <greg@turnstep.com> writes:
> I am in the process of adding some external interfaces to the temporary 
> relations (started as a goal of being able to view temporary 
> tables in psql with \d).

I think you're wasting your time to think about this now.  By the time
7.3 comes out, we will have an entirely new approach to temp tables:
they'll be named with the same names the user sees, and live in
per-backend temp schemas to avoid name conflicts with permanent tables.
So any code based on working with the existing temp-name mapper will
be in the scrap heap before it can get released :-(

> How do I choose a new OID when adding something 
> to include/catalog/pg_proc.h? 

See unused_oids.
        regards, tom lane


Re: New system OIDS inside include/catalog/pg_proc.h

From
"Greg Sabino Mullane"
Date:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> I think you're wasting your time to think about this now.  By 
> the time 7.3 comes out, we will have an entirely new approach 
> to temp tables: they'll be named with the same names the user 
> sees, and live in per-backend temp schemas to avoid name 
> conflicts with permanent tables. So any code based on working 
> with the existing temp-name mapper will be in the scrap heap 
> before it can get released :-(

Thank you for the heads-up. Yes, this means some of my code is 
now "scrapped" but I did learn a lot in the process. I seem to 
recall that at least one other person was recently pointed to 
temprel.c (I think for temporary views?) so may I suggest 
that a README be added to the backend/utils/cache directory, or 
perhaps a comment at the top of temprel.c stating something 
similar to the quoted paragraph above, so that others will not 
use the soon-to-be-replaced temp-name code.

Also, thanks for the replies regarding the unused oids. As I 
suspected, there is no rhyme or reason. :)

Greg Sabino Mullane greg@turnstep.com
PGP Key: 0x14964AC8 200202060731

-----BEGIN PGP SIGNATURE-----
Comment: http://www.turnstep.com/pgp.html

iQA/AwUBPGEitrybkGcUlkrIEQKZxQCgwNiBrgA/yl7ZnMfYaTsvwZkamVQAoMDU
E0YzIE0qVN1XI08jCyA74LKq
=CjLE
-----END PGP SIGNATURE-----