Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 85475af

Browse files
committed
Cosmetic improvement: use BKI_DEFAULT and BKI_LOOKUP in pg_language.
The point of this is not really to remove redundancy in pg_language.dat; with only three entries, it's hardly worth it. Rather, it is to get to a point where there are exactly zero hard-coded numeric pg_proc OID references in the catalog .dat files. The lanvalidator column was the only remaining location of such references, and it seems like a good thing for future-proofing reasons to make it not be a special case. There are still a few places in the .dat files with numeric OID references to other catalogs, but after review I don't see any that seem worth changing at present. In each case there are just too few entries to make it worth the trouble to create lookup infrastructure. This doesn't change the emitted postgres.bki file, so no catversion bump.
1 parent 9cb7db3 commit 85475af

File tree

2 files changed

+25
-17
lines changed

2 files changed

+25
-17
lines changed

src/include/catalog/pg_language.dat

+3-9
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,12 @@
1414

1515
{ oid => '12', oid_symbol => 'INTERNALlanguageId',
1616
descr => 'built-in functions',
17-
lanname => 'internal', lanowner => 'PGUID', lanispl => 'f',
18-
lanpltrusted => 'f', lanplcallfoid => '0', laninline => '0',
19-
lanvalidator => '2246', lanacl => '_null_' },
17+
lanname => 'internal', lanvalidator => 'fmgr_internal_validator' },
2018
{ oid => '13', oid_symbol => 'ClanguageId',
2119
descr => 'dynamically-loaded C functions',
22-
lanname => 'c', lanowner => 'PGUID', lanispl => 'f', lanpltrusted => 'f',
23-
lanplcallfoid => '0', laninline => '0', lanvalidator => '2247',
24-
lanacl => '_null_' },
20+
lanname => 'c', lanvalidator => 'fmgr_c_validator' },
2521
{ oid => '14', oid_symbol => 'SQLlanguageId',
2622
descr => 'SQL-language functions',
27-
lanname => 'sql', lanowner => 'PGUID', lanispl => 'f', lanpltrusted => 't',
28-
lanplcallfoid => '0', laninline => '0', lanvalidator => '2248',
29-
lanacl => '_null_' },
23+
lanname => 'sql', lanpltrusted => 't', lanvalidator => 'fmgr_sql_validator' },
3024

3125
]

src/include/catalog/pg_language.h

+22-8
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,30 @@
2828
*/
2929
CATALOG(pg_language,2612,LanguageRelationId)
3030
{
31-
NameData lanname; /* Language name */
32-
Oid lanowner; /* Language's owner */
33-
bool lanispl; /* Is a procedural language */
34-
bool lanpltrusted; /* PL is trusted */
35-
Oid lanplcallfoid; /* Call handler for PL */
36-
Oid laninline; /* Optional anonymous-block handler function */
37-
Oid lanvalidator; /* Optional validation function */
31+
/* Language name */
32+
NameData lanname;
33+
34+
/* Language's owner */
35+
Oid lanowner BKI_DEFAULT(PGUID);
36+
37+
/* Is a procedural language */
38+
bool lanispl BKI_DEFAULT(f);
39+
40+
/* PL is trusted */
41+
bool lanpltrusted BKI_DEFAULT(f);
42+
43+
/* Call handler, if it's a PL */
44+
Oid lanplcallfoid BKI_DEFAULT(0) BKI_LOOKUP(pg_proc);
45+
46+
/* Optional anonymous-block handler function */
47+
Oid laninline BKI_DEFAULT(0) BKI_LOOKUP(pg_proc);
48+
49+
/* Optional validation function */
50+
Oid lanvalidator BKI_DEFAULT(0) BKI_LOOKUP(pg_proc);
3851

3952
#ifdef CATALOG_VARLEN /* variable-length fields start here */
40-
aclitem lanacl[1]; /* Access privileges */
53+
/* Access privileges */
54+
aclitem lanacl[1] BKI_DEFAULT(_null_);
4155
#endif
4256
} FormData_pg_language;
4357

0 commit comments

Comments
 (0)