Thread: last built-in oid
Hi, What is the current way of getting the last built-in oid? I looked at the source of pg_dump, and it does this: SELECT datlastsysoid from pg_database where datname = 'dbname' But as far as I can tell, the datlastsysoid field does not exist in pg_database. What gives? -- Christopher Kings-Lynne Family Health Network (ACN 089 639 243)
At 11:27 24/11/00 +0800, Christopher Kings-Lynne wrote: > >SELECT datlastsysoid from pg_database where datname = 'dbname' > >But as far as I can tell, the datlastsysoid field does not exist in >pg_database. > If you build from CVS and do an initdb, you will find datlastsysoid should exist... ---------------------------------------------------------------- Philip Warner | __---_____ Albatross Consulting Pty. Ltd. |----/ - \ (A.B.N. 75 008 659 498) | /(@) ______---_ Tel: (+61) 0500 83 82 81 | _________ \ Fax: (+61) 0500 83 82 82 | ___________ | Http://www.rhyme.com.au | / \| | --________-- PGP key available upon request, | / and from pgp5.ai.mit.edu:11371 |/
Ah. What about in 7.0.3 and below? Basically this because I am attempting to select all built-in functions. I would like it to be backwards compatible, if at all possible. Chris > -----Original Message----- > From: Philip Warner [mailto:pjw@rhyme.com.au] > Sent: Friday, November 24, 2000 11:47 AM > To: Christopher Kings-Lynne; Pgsql-Hackers > Subject: Re: [HACKERS] last built-in oid > > > At 11:27 24/11/00 +0800, Christopher Kings-Lynne wrote: > > > >SELECT datlastsysoid from pg_database where datname = 'dbname' > > > >But as far as I can tell, the datlastsysoid field does not exist in > >pg_database. > > > > If you build from CVS and do an initdb, you will find datlastsysoid should > exist... > > > ---------------------------------------------------------------- > Philip Warner | __---_____ > Albatross Consulting Pty. Ltd. |----/ - \ > (A.B.N. 75 008 659 498) | /(@) ______---_ > Tel: (+61) 0500 83 82 81 | _________ \ > Fax: (+61) 0500 83 82 82 | ___________ | > Http://www.rhyme.com.au | / \| > | --________-- > PGP key available upon request, | / > and from pgp5.ai.mit.edu:11371 |/ >
"Christopher Kings-Lynne" <chriskl@familyhealth.com.au> writes: > Ah. What about in 7.0.3 and below? There is no good way --- if there were, we'd not have bothered to invent datlastsysoid. pg_dump used to use the OID of the template1 database as an estimate of the last built-in OID. This was wrong to begin with, and is completely untenable in 7.1 (template1's OID is now 1). > Basically this because I am attempting to select all built-in > functions. If you only care about functions then it's probably possible to hard-wire an assumption that system functions have OIDs < 16384. Right now all built-in functions have manually-assigned OIDs, so that works. But I wouldn't want to promise that it'll work forever. It already doesn't work for aggregates, for example (were you including aggregates in "functions"?). regards, tom lane