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

Commit 36b9312

Browse files
committed
Don't use custom OID symbols in pg_proc.dat.
We have a perfectly good convention for OID macros for built-in functions already, so making custom symbols is just introducing unnecessary deviation from the convention. Remove the one case that had snuck in, and add an error check in genbki.pl to discourage future instances. Although this touches pg_proc.dat, there's no need for a catversion bump since the actual catalog data isn't changed. John Naylor Discussion: https://postgr.es/m/CAFBsxsHpCbjfoddNGpnnnY5pHwckWfiYkMYSF74PmP1su0+ZOw@mail.gmail.com
1 parent ad1c36b commit 36b9312

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

src/backend/catalog/genbki.pl

+7
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,13 @@
602602
# Emit OID symbol
603603
if (defined $bki_values{oid_symbol})
604604
{
605+
# OID symbols for builtin functions are handled automatically
606+
# by utils/Gen_fmgrtab.pl
607+
die sprintf
608+
"custom OID symbols are not allowed for pg_proc entries: '%s'",
609+
$bki_values{oid_symbol}
610+
if $catname eq 'pg_proc';
611+
605612
printf $def "#define %s %s\n",
606613
$bki_values{oid_symbol}, $bki_values{oid};
607614
}

src/backend/utils/cache/relcache.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1761,15 +1761,15 @@ RelationInitTableAccessMethod(Relation relation)
17611761
* seem prudent to show that in the catalog. So just overwrite it
17621762
* here.
17631763
*/
1764-
relation->rd_amhandler = HEAP_TABLE_AM_HANDLER_OID;
1764+
relation->rd_amhandler = F_HEAP_TABLEAM_HANDLER;
17651765
}
17661766
else if (IsCatalogRelation(relation))
17671767
{
17681768
/*
17691769
* Avoid doing a syscache lookup for catalog tables.
17701770
*/
17711771
Assert(relation->rd_rel->relam == HEAP_TABLE_AM_OID);
1772-
relation->rd_amhandler = HEAP_TABLE_AM_HANDLER_OID;
1772+
relation->rd_amhandler = F_HEAP_TABLEAM_HANDLER;
17731773
}
17741774
else
17751775
{

src/include/catalog/pg_proc.dat

+1-2
Original file line numberDiff line numberDiff line change
@@ -901,8 +901,7 @@
901901
prosrc => 'ftoi4' },
902902

903903
# Table access method handlers
904-
{ oid => '3', oid_symbol => 'HEAP_TABLE_AM_HANDLER_OID',
905-
descr => 'row-oriented heap table access method handler',
904+
{ oid => '3', descr => 'row-oriented heap table access method handler',
906905
proname => 'heap_tableam_handler', provolatile => 'v',
907906
prorettype => 'table_am_handler', proargtypes => 'internal',
908907
prosrc => 'heap_tableam_handler' },

0 commit comments

Comments
 (0)