Commit 814c9019 authored by Tom Lane's avatar Tom Lane

Use symbolic references for pg_language OIDs in the bootstrap data.

This patch teaches genbki.pl to replace pg_language names by OIDs
in much the same way as it already does for pg_am names etc, and
converts pg_proc.dat to use such symbolic references in the prolang
column.

Aside from getting rid of a few more magic numbers in the initial
catalog data, this means that Gen_fmgrtab.pl no longer needs to read
pg_language.dat, since it doesn't have to know the OID of the "internal"
language; now it's just looking for the string "internal".

No need for a catversion bump, since the contents of postgres.bki
don't actually change at all.

John Naylor

Discussion: https://postgr.es/m/CAJVSVGWtUqxpfAaxS88vEGvi+jKzWZb2EStu5io-UPc4p9rSJg@mail.gmail.com
parent 7170268e
...@@ -409,8 +409,9 @@ ...@@ -409,8 +409,9 @@
that's error-prone and hard to understand, so for frequently-referenced that's error-prone and hard to understand, so for frequently-referenced
catalogs, <filename>genbki.pl</filename> provides mechanisms to write catalogs, <filename>genbki.pl</filename> provides mechanisms to write
symbolic references instead. Currently this is possible for references symbolic references instead. Currently this is possible for references
to access methods, functions, operators, opclasses, opfamilies, and to access methods, functions, languages,
types. The rules are as follows: operators, opclasses, opfamilies, and types.
The rules are as follows:
</para> </para>
<itemizedlist> <itemizedlist>
...@@ -421,6 +422,7 @@ ...@@ -421,6 +422,7 @@
by attaching <literal>BKI_LOOKUP(<replaceable>lookuprule</replaceable>)</literal> by attaching <literal>BKI_LOOKUP(<replaceable>lookuprule</replaceable>)</literal>
to the column's definition, where <replaceable>lookuprule</replaceable> to the column's definition, where <replaceable>lookuprule</replaceable>
is <literal>pg_am</literal>, <literal>pg_proc</literal>, is <literal>pg_am</literal>, <literal>pg_proc</literal>,
<literal>pg_language</literal>,
<literal>pg_operator</literal>, <literal>pg_opclass</literal>, <literal>pg_operator</literal>, <literal>pg_opclass</literal>,
<literal>pg_opfamily</literal>, or <literal>pg_type</literal>. <literal>pg_opfamily</literal>, or <literal>pg_type</literal>.
<literal>BKI_LOOKUP</literal> can be attached to columns of <literal>BKI_LOOKUP</literal> can be attached to columns of
......
...@@ -178,13 +178,20 @@ my $PG_CATALOG_NAMESPACE = ...@@ -178,13 +178,20 @@ my $PG_CATALOG_NAMESPACE =
# Build lookup tables for OID macro substitutions and for pg_attribute # Build lookup tables for OID macro substitutions and for pg_attribute
# copies of pg_type values. # copies of pg_type values.
# index access method OID lookup # access method OID lookup
my %amoids; my %amoids;
foreach my $row (@{ $catalog_data{pg_am} }) foreach my $row (@{ $catalog_data{pg_am} })
{ {
$amoids{ $row->{amname} } = $row->{oid}; $amoids{ $row->{amname} } = $row->{oid};
} }
# language OID lookup
my %langoids;
foreach my $row (@{ $catalog_data{pg_language} })
{
$langoids{ $row->{lanname} } = $row->{oid};
}
# opclass OID lookup # opclass OID lookup
my %opcoids; my %opcoids;
foreach my $row (@{ $catalog_data{pg_opclass} }) foreach my $row (@{ $catalog_data{pg_opclass} })
...@@ -259,6 +266,7 @@ foreach my $row (@{ $catalog_data{pg_type} }) ...@@ -259,6 +266,7 @@ foreach my $row (@{ $catalog_data{pg_type} })
# Map catalog name to OID lookup. # Map catalog name to OID lookup.
my %lookup_kind = ( my %lookup_kind = (
pg_am => \%amoids, pg_am => \%amoids,
pg_language => \%langoids,
pg_opclass => \%opcoids, pg_opclass => \%opcoids,
pg_operator => \%operoids, pg_operator => \%operoids,
pg_opfamily => \%opfoids, pg_opfamily => \%opfoids,
......
...@@ -59,6 +59,8 @@ die "No include path; you must specify -I.\n" if !$include_path; ...@@ -59,6 +59,8 @@ die "No include path; you must specify -I.\n" if !$include_path;
# Note: We pass data file names as arguments and then look for matching # Note: We pass data file names as arguments and then look for matching
# headers to parse the schema from. This is backwards from genbki.pl, # headers to parse the schema from. This is backwards from genbki.pl,
# but the Makefile dependencies look more sensible this way. # but the Makefile dependencies look more sensible this way.
# We currently only need pg_proc, but retain the possibility of reading
# more than one data file.
my %catalogs; my %catalogs;
my %catalog_data; my %catalog_data;
foreach my $datfile (@input_files) foreach my $datfile (@input_files)
...@@ -82,9 +84,6 @@ foreach my $datfile (@input_files) ...@@ -82,9 +84,6 @@ foreach my $datfile (@input_files)
my $FirstGenbkiObjectId = my $FirstGenbkiObjectId =
Catalog::FindDefinedSymbol('access/transam.h', $include_path, Catalog::FindDefinedSymbol('access/transam.h', $include_path,
'FirstGenbkiObjectId'); 'FirstGenbkiObjectId');
my $INTERNALlanguageId =
Catalog::FindDefinedSymbolFromData($catalog_data{pg_language},
'INTERNALlanguageId');
# Collect certain fields from pg_proc.dat. # Collect certain fields from pg_proc.dat.
my @fmgr = (); my @fmgr = ();
...@@ -94,7 +93,7 @@ foreach my $row (@{ $catalog_data{pg_proc} }) ...@@ -94,7 +93,7 @@ foreach my $row (@{ $catalog_data{pg_proc} })
my %bki_values = %$row; my %bki_values = %$row;
# Select out just the rows for internal-language procedures. # Select out just the rows for internal-language procedures.
next if $bki_values{prolang} ne $INTERNALlanguageId; next if $bki_values{prolang} ne 'internal';
push @fmgr, push @fmgr,
{ {
......
...@@ -31,15 +31,11 @@ generated-header-symlinks: $(top_builddir)/src/include/utils/header-stamp $(top_ ...@@ -31,15 +31,11 @@ generated-header-symlinks: $(top_builddir)/src/include/utils/header-stamp $(top_
$(SUBDIRS:%=%-recursive): fmgr-stamp errcodes.h $(SUBDIRS:%=%-recursive): fmgr-stamp errcodes.h
FMGR_DATA := $(addprefix $(top_srcdir)/src/include/catalog/,\
pg_language.dat pg_proc.dat \
)
# fmgr-stamp records the last time we ran Gen_fmgrtab.pl. We don't rely on # fmgr-stamp records the last time we ran Gen_fmgrtab.pl. We don't rely on
# the timestamps of the individual output files, because the Perl script # the timestamps of the individual output files, because the Perl script
# won't update them if they didn't change (to avoid unnecessary recompiles). # won't update them if they didn't change (to avoid unnecessary recompiles).
fmgr-stamp: Gen_fmgrtab.pl $(catalogdir)/Catalog.pm $(FMGR_DATA) $(top_srcdir)/src/include/access/transam.h fmgr-stamp: Gen_fmgrtab.pl $(catalogdir)/Catalog.pm $(top_srcdir)/src/include/catalog/pg_proc.dat $(top_srcdir)/src/include/access/transam.h
$(PERL) -I $(catalogdir) $< -I $(top_srcdir)/src/include/ $(FMGR_DATA) $(PERL) -I $(catalogdir) $< -I $(top_srcdir)/src/include/ $(top_srcdir)/src/include/catalog/pg_proc.dat
touch $@ touch $@
errcodes.h: $(top_srcdir)/src/backend/utils/errcodes.txt generate-errcodes.pl errcodes.h: $(top_srcdir)/src/backend/utils/errcodes.txt generate-errcodes.pl
......
...@@ -2257,7 +2257,7 @@ ...@@ -2257,7 +2257,7 @@
proname => 'justify_days', prorettype => 'interval', proname => 'justify_days', prorettype => 'interval',
proargtypes => 'interval', prosrc => 'interval_justify_days' }, proargtypes => 'interval', prosrc => 'interval_justify_days' },
{ oid => '1176', descr => 'convert date and time to timestamp with time zone', { oid => '1176', descr => 'convert date and time to timestamp with time zone',
proname => 'timestamptz', prolang => '14', provolatile => 's', proname => 'timestamptz', prolang => 'sql', provolatile => 's',
prorettype => 'timestamptz', proargtypes => 'date time', prorettype => 'timestamptz', proargtypes => 'date time',
prosrc => 'select cast(($1 + $2) as timestamp with time zone)' }, prosrc => 'select cast(($1 + $2) as timestamp with time zone)' },
{ oid => '1178', descr => 'convert timestamp with time zone to date', { oid => '1178', descr => 'convert timestamp with time zone to date',
...@@ -2310,16 +2310,16 @@ ...@@ -2310,16 +2310,16 @@
prosrc => 'interval_scale' }, prosrc => 'interval_scale' },
{ oid => '1215', descr => 'get description for object id and catalog name', { oid => '1215', descr => 'get description for object id and catalog name',
proname => 'obj_description', prolang => '14', procost => '100', proname => 'obj_description', prolang => 'sql', procost => '100',
provolatile => 's', prorettype => 'text', proargtypes => 'oid name', provolatile => 's', prorettype => 'text', proargtypes => 'oid name',
prosrc => 'select description from pg_catalog.pg_description where objoid = $1 and classoid = (select oid from pg_catalog.pg_class where relname = $2 and relnamespace = PGNSP) and objsubid = 0' }, prosrc => 'select description from pg_catalog.pg_description where objoid = $1 and classoid = (select oid from pg_catalog.pg_class where relname = $2 and relnamespace = PGNSP) and objsubid = 0' },
{ oid => '1216', descr => 'get description for table column', { oid => '1216', descr => 'get description for table column',
proname => 'col_description', prolang => '14', procost => '100', proname => 'col_description', prolang => 'sql', procost => '100',
provolatile => 's', prorettype => 'text', proargtypes => 'oid int4', provolatile => 's', prorettype => 'text', proargtypes => 'oid int4',
prosrc => 'select description from pg_catalog.pg_description where objoid = $1 and classoid = \'pg_catalog.pg_class\'::pg_catalog.regclass and objsubid = $2' }, prosrc => 'select description from pg_catalog.pg_description where objoid = $1 and classoid = \'pg_catalog.pg_class\'::pg_catalog.regclass and objsubid = $2' },
{ oid => '1993', { oid => '1993',
descr => 'get description for object id and shared catalog name', descr => 'get description for object id and shared catalog name',
proname => 'shobj_description', prolang => '14', procost => '100', proname => 'shobj_description', prolang => 'sql', procost => '100',
provolatile => 's', prorettype => 'text', proargtypes => 'oid name', provolatile => 's', prorettype => 'text', proargtypes => 'oid name',
prosrc => 'select description from pg_catalog.pg_shdescription where objoid = $1 and classoid = (select oid from pg_catalog.pg_class where relname = $2 and relnamespace = PGNSP)' }, prosrc => 'select description from pg_catalog.pg_shdescription where objoid = $1 and classoid = (select oid from pg_catalog.pg_class where relname = $2 and relnamespace = PGNSP)' },
...@@ -2492,13 +2492,13 @@ ...@@ -2492,13 +2492,13 @@
prosrc => 'hashtidextended' }, prosrc => 'hashtidextended' },
{ oid => '1296', { oid => '1296',
proname => 'timedate_pl', prolang => '14', prorettype => 'timestamp', proname => 'timedate_pl', prolang => 'sql', prorettype => 'timestamp',
proargtypes => 'time date', prosrc => 'select ($2 + $1)' }, proargtypes => 'time date', prosrc => 'select ($2 + $1)' },
{ oid => '1297', { oid => '1297',
proname => 'datetimetz_pl', prorettype => 'timestamptz', proname => 'datetimetz_pl', prorettype => 'timestamptz',
proargtypes => 'date timetz', prosrc => 'datetimetz_timestamptz' }, proargtypes => 'date timetz', prosrc => 'datetimetz_timestamptz' },
{ oid => '1298', { oid => '1298',
proname => 'timetzdate_pl', prolang => '14', prorettype => 'timestamptz', proname => 'timetzdate_pl', prolang => 'sql', prorettype => 'timestamptz',
proargtypes => 'timetz date', prosrc => 'select ($2 + $1)' }, proargtypes => 'timetz date', prosrc => 'select ($2 + $1)' },
{ oid => '1299', descr => 'current transaction time', { oid => '1299', descr => 'current transaction time',
proname => 'now', provolatile => 's', prorettype => 'timestamptz', proname => 'now', provolatile => 's', prorettype => 'timestamptz',
...@@ -2540,17 +2540,17 @@ ...@@ -2540,17 +2540,17 @@
proargtypes => 'timestamptz timestamptz timestamptz timestamptz', proargtypes => 'timestamptz timestamptz timestamptz timestamptz',
prosrc => 'overlaps_timestamp' }, prosrc => 'overlaps_timestamp' },
{ oid => '1305', descr => 'intervals overlap?', { oid => '1305', descr => 'intervals overlap?',
proname => 'overlaps', prolang => '14', proisstrict => 'f', proname => 'overlaps', prolang => 'sql', proisstrict => 'f',
provolatile => 's', prorettype => 'bool', provolatile => 's', prorettype => 'bool',
proargtypes => 'timestamptz interval timestamptz interval', proargtypes => 'timestamptz interval timestamptz interval',
prosrc => 'select ($1, ($1 + $2)) overlaps ($3, ($3 + $4))' }, prosrc => 'select ($1, ($1 + $2)) overlaps ($3, ($3 + $4))' },
{ oid => '1306', descr => 'intervals overlap?', { oid => '1306', descr => 'intervals overlap?',
proname => 'overlaps', prolang => '14', proisstrict => 'f', proname => 'overlaps', prolang => 'sql', proisstrict => 'f',
provolatile => 's', prorettype => 'bool', provolatile => 's', prorettype => 'bool',
proargtypes => 'timestamptz timestamptz timestamptz interval', proargtypes => 'timestamptz timestamptz timestamptz interval',
prosrc => 'select ($1, $2) overlaps ($3, ($3 + $4))' }, prosrc => 'select ($1, $2) overlaps ($3, ($3 + $4))' },
{ oid => '1307', descr => 'intervals overlap?', { oid => '1307', descr => 'intervals overlap?',
proname => 'overlaps', prolang => '14', proisstrict => 'f', proname => 'overlaps', prolang => 'sql', proisstrict => 'f',
provolatile => 's', prorettype => 'bool', provolatile => 's', prorettype => 'bool',
proargtypes => 'timestamptz interval timestamptz timestamptz', proargtypes => 'timestamptz interval timestamptz timestamptz',
prosrc => 'select ($1, ($1 + $2)) overlaps ($3, $4)' }, prosrc => 'select ($1, ($1 + $2)) overlaps ($3, $4)' },
...@@ -2559,15 +2559,15 @@ ...@@ -2559,15 +2559,15 @@
proname => 'overlaps', proisstrict => 'f', prorettype => 'bool', proname => 'overlaps', proisstrict => 'f', prorettype => 'bool',
proargtypes => 'time time time time', prosrc => 'overlaps_time' }, proargtypes => 'time time time time', prosrc => 'overlaps_time' },
{ oid => '1309', descr => 'intervals overlap?', { oid => '1309', descr => 'intervals overlap?',
proname => 'overlaps', prolang => '14', proisstrict => 'f', proname => 'overlaps', prolang => 'sql', proisstrict => 'f',
prorettype => 'bool', proargtypes => 'time interval time interval', prorettype => 'bool', proargtypes => 'time interval time interval',
prosrc => 'select ($1, ($1 + $2)) overlaps ($3, ($3 + $4))' }, prosrc => 'select ($1, ($1 + $2)) overlaps ($3, ($3 + $4))' },
{ oid => '1310', descr => 'intervals overlap?', { oid => '1310', descr => 'intervals overlap?',
proname => 'overlaps', prolang => '14', proisstrict => 'f', proname => 'overlaps', prolang => 'sql', proisstrict => 'f',
prorettype => 'bool', proargtypes => 'time time time interval', prorettype => 'bool', proargtypes => 'time time time interval',
prosrc => 'select ($1, $2) overlaps ($3, ($3 + $4))' }, prosrc => 'select ($1, $2) overlaps ($3, ($3 + $4))' },
{ oid => '1311', descr => 'intervals overlap?', { oid => '1311', descr => 'intervals overlap?',
proname => 'overlaps', prolang => '14', proisstrict => 'f', proname => 'overlaps', prolang => 'sql', proisstrict => 'f',
prorettype => 'bool', proargtypes => 'time interval time time', prorettype => 'bool', proargtypes => 'time interval time time',
prosrc => 'select ($1, ($1 + $2)) overlaps ($3, $4)' }, prosrc => 'select ($1, ($1 + $2)) overlaps ($3, $4)' },
...@@ -2645,7 +2645,7 @@ ...@@ -2645,7 +2645,7 @@
# This form of obj_description is now deprecated, since it will fail if # This form of obj_description is now deprecated, since it will fail if
# OIDs are not unique across system catalogs. Use the other form instead. # OIDs are not unique across system catalogs. Use the other form instead.
{ oid => '1348', descr => 'deprecated, use two-argument form instead', { oid => '1348', descr => 'deprecated, use two-argument form instead',
proname => 'obj_description', prolang => '14', procost => '100', proname => 'obj_description', prolang => 'sql', procost => '100',
provolatile => 's', prorettype => 'text', proargtypes => 'oid', provolatile => 's', prorettype => 'text', proargtypes => 'oid',
prosrc => 'select description from pg_catalog.pg_description where objoid = $1 and objsubid = 0' }, prosrc => 'select description from pg_catalog.pg_description where objoid = $1 and objsubid = 0' },
...@@ -2729,7 +2729,7 @@ ...@@ -2729,7 +2729,7 @@
prosrc => 'textlen' }, prosrc => 'textlen' },
{ oid => '1384', descr => 'extract field from date', { oid => '1384', descr => 'extract field from date',
proname => 'date_part', prolang => '14', prorettype => 'float8', proname => 'date_part', prolang => 'sql', prorettype => 'float8',
proargtypes => 'text date', proargtypes => 'text date',
prosrc => 'select pg_catalog.date_part($1, cast($2 as timestamp without time zone))' }, prosrc => 'select pg_catalog.date_part($1, cast($2 as timestamp without time zone))' },
{ oid => '1385', descr => 'extract field from time', { oid => '1385', descr => 'extract field from time',
...@@ -2737,7 +2737,7 @@ ...@@ -2737,7 +2737,7 @@
prosrc => 'time_part' }, prosrc => 'time_part' },
{ oid => '1386', { oid => '1386',
descr => 'date difference from today preserving months and years', descr => 'date difference from today preserving months and years',
proname => 'age', prolang => '14', provolatile => 's', proname => 'age', prolang => 'sql', provolatile => 's',
prorettype => 'interval', proargtypes => 'timestamptz', prorettype => 'interval', proargtypes => 'timestamptz',
prosrc => 'select pg_catalog.age(cast(current_date as timestamp with time zone), $1)' }, prosrc => 'select pg_catalog.age(cast(current_date as timestamp with time zone), $1)' },
...@@ -2852,7 +2852,7 @@ ...@@ -2852,7 +2852,7 @@
proname => 'box_div', prorettype => 'box', proargtypes => 'box point', proname => 'box_div', prorettype => 'box', proargtypes => 'box point',
prosrc => 'box_div' }, prosrc => 'box_div' },
{ oid => '1426', { oid => '1426',
proname => 'path_contain_pt', prolang => '14', prorettype => 'bool', proname => 'path_contain_pt', prolang => 'sql', prorettype => 'bool',
proargtypes => 'path point', prosrc => 'select pg_catalog.on_ppath($2, $1)' }, proargtypes => 'path point', prosrc => 'select pg_catalog.on_ppath($2, $1)' },
{ oid => '1428', { oid => '1428',
proname => 'poly_contain_pt', prorettype => 'bool', proname => 'poly_contain_pt', prorettype => 'bool',
...@@ -3112,7 +3112,7 @@ ...@@ -3112,7 +3112,7 @@
proname => 'center', prorettype => 'point', proargtypes => 'circle', proname => 'center', prorettype => 'point', proargtypes => 'circle',
prosrc => 'circle_center' }, prosrc => 'circle_center' },
{ oid => '1544', descr => 'convert circle to 12-vertex polygon', { oid => '1544', descr => 'convert circle to 12-vertex polygon',
proname => 'polygon', prolang => '14', prorettype => 'polygon', proname => 'polygon', prolang => 'sql', prorettype => 'polygon',
proargtypes => 'circle', prosrc => 'select pg_catalog.polygon(12, $1)' }, proargtypes => 'circle', prosrc => 'select pg_catalog.polygon(12, $1)' },
{ oid => '1545', descr => 'number of points', { oid => '1545', descr => 'number of points',
proname => 'npoints', prorettype => 'int4', proargtypes => 'path', proname => 'npoints', prorettype => 'int4', proargtypes => 'path',
...@@ -3379,11 +3379,11 @@ ...@@ -3379,11 +3379,11 @@
proname => 'translate', prorettype => 'text', proargtypes => 'text text text', proname => 'translate', prorettype => 'text', proargtypes => 'text text text',
prosrc => 'translate' }, prosrc => 'translate' },
{ oid => '879', descr => 'left-pad string to length', { oid => '879', descr => 'left-pad string to length',
proname => 'lpad', prolang => '14', prorettype => 'text', proname => 'lpad', prolang => 'sql', prorettype => 'text',
proargtypes => 'text int4', proargtypes => 'text int4',
prosrc => 'select pg_catalog.lpad($1, $2, \' \')' }, prosrc => 'select pg_catalog.lpad($1, $2, \' \')' },
{ oid => '880', descr => 'right-pad string to length', { oid => '880', descr => 'right-pad string to length',
proname => 'rpad', prolang => '14', prorettype => 'text', proname => 'rpad', prolang => 'sql', prorettype => 'text',
proargtypes => 'text int4', proargtypes => 'text int4',
prosrc => 'select pg_catalog.rpad($1, $2, \' \')' }, prosrc => 'select pg_catalog.rpad($1, $2, \' \')' },
{ oid => '881', descr => 'trim spaces from left end of string', { oid => '881', descr => 'trim spaces from left end of string',
...@@ -3968,7 +3968,7 @@ ...@@ -3968,7 +3968,7 @@
proname => 'inetpl', prorettype => 'inet', proargtypes => 'inet int8', proname => 'inetpl', prorettype => 'inet', proargtypes => 'inet int8',
prosrc => 'inetpl' }, prosrc => 'inetpl' },
{ oid => '2631', { oid => '2631',
proname => 'int8pl_inet', prolang => '14', prorettype => 'inet', proname => 'int8pl_inet', prolang => 'sql', prorettype => 'inet',
proargtypes => 'int8 inet', prosrc => 'select $2 + $1' }, proargtypes => 'int8 inet', prosrc => 'select $2 + $1' },
{ oid => '2632', { oid => '2632',
proname => 'inetmi_int8', prorettype => 'inet', proargtypes => 'inet int8', proname => 'inetmi_int8', prorettype => 'inet', proargtypes => 'inet int8',
...@@ -4100,13 +4100,13 @@ ...@@ -4100,13 +4100,13 @@
proname => 'round', prorettype => 'numeric', proargtypes => 'numeric int4', proname => 'round', prorettype => 'numeric', proargtypes => 'numeric int4',
prosrc => 'numeric_round' }, prosrc => 'numeric_round' },
{ oid => '1708', descr => 'value rounded to \'scale\' of zero', { oid => '1708', descr => 'value rounded to \'scale\' of zero',
proname => 'round', prolang => '14', prorettype => 'numeric', proname => 'round', prolang => 'sql', prorettype => 'numeric',
proargtypes => 'numeric', prosrc => 'select pg_catalog.round($1,0)' }, proargtypes => 'numeric', prosrc => 'select pg_catalog.round($1,0)' },
{ oid => '1709', descr => 'value truncated to \'scale\'', { oid => '1709', descr => 'value truncated to \'scale\'',
proname => 'trunc', prorettype => 'numeric', proargtypes => 'numeric int4', proname => 'trunc', prorettype => 'numeric', proargtypes => 'numeric int4',
prosrc => 'numeric_trunc' }, prosrc => 'numeric_trunc' },
{ oid => '1710', descr => 'value truncated to \'scale\' of zero', { oid => '1710', descr => 'value truncated to \'scale\' of zero',
proname => 'trunc', prolang => '14', prorettype => 'numeric', proname => 'trunc', prolang => 'sql', prorettype => 'numeric',
proargtypes => 'numeric', prosrc => 'select pg_catalog.trunc($1,0)' }, proargtypes => 'numeric', prosrc => 'select pg_catalog.trunc($1,0)' },
{ oid => '1711', descr => 'nearest integer >= value', { oid => '1711', descr => 'nearest integer >= value',
proname => 'ceil', prorettype => 'numeric', proargtypes => 'numeric', proname => 'ceil', prorettype => 'numeric', proargtypes => 'numeric',
...@@ -4193,7 +4193,7 @@ ...@@ -4193,7 +4193,7 @@
proname => 'numeric', prorettype => 'numeric', proargtypes => 'int4', proname => 'numeric', prorettype => 'numeric', proargtypes => 'int4',
prosrc => 'int4_numeric' }, prosrc => 'int4_numeric' },
{ oid => '1741', descr => 'base 10 logarithm', { oid => '1741', descr => 'base 10 logarithm',
proname => 'log', prolang => '14', prorettype => 'numeric', proname => 'log', prolang => 'sql', prorettype => 'numeric',
proargtypes => 'numeric', prosrc => 'select pg_catalog.log(10, $1)' }, proargtypes => 'numeric', prosrc => 'select pg_catalog.log(10, $1)' },
{ oid => '1742', descr => 'convert float4 to numeric', { oid => '1742', descr => 'convert float4 to numeric',
proname => 'numeric', prorettype => 'numeric', proargtypes => 'float4', proname => 'numeric', prorettype => 'numeric', proargtypes => 'float4',
...@@ -4326,7 +4326,7 @@ ...@@ -4326,7 +4326,7 @@
proname => 'quote_literal', prorettype => 'text', proargtypes => 'text', proname => 'quote_literal', prorettype => 'text', proargtypes => 'text',
prosrc => 'quote_literal' }, prosrc => 'quote_literal' },
{ oid => '1285', descr => 'quote a data value for usage in a querystring', { oid => '1285', descr => 'quote a data value for usage in a querystring',
proname => 'quote_literal', prolang => '14', provolatile => 's', proname => 'quote_literal', prolang => 'sql', provolatile => 's',
prorettype => 'text', proargtypes => 'anyelement', prorettype => 'text', proargtypes => 'anyelement',
prosrc => 'select pg_catalog.quote_literal($1::pg_catalog.text)' }, prosrc => 'select pg_catalog.quote_literal($1::pg_catalog.text)' },
{ oid => '1289', { oid => '1289',
...@@ -4335,7 +4335,7 @@ ...@@ -4335,7 +4335,7 @@
proargtypes => 'text', prosrc => 'quote_nullable' }, proargtypes => 'text', prosrc => 'quote_nullable' },
{ oid => '1290', { oid => '1290',
descr => 'quote a possibly-null data value for usage in a querystring', descr => 'quote a possibly-null data value for usage in a querystring',
proname => 'quote_nullable', prolang => '14', proisstrict => 'f', proname => 'quote_nullable', prolang => 'sql', proisstrict => 'f',
provolatile => 's', prorettype => 'text', proargtypes => 'anyelement', provolatile => 's', prorettype => 'text', proargtypes => 'anyelement',
prosrc => 'select pg_catalog.quote_nullable($1::pg_catalog.text)' }, prosrc => 'select pg_catalog.quote_nullable($1::pg_catalog.text)' },
...@@ -4374,13 +4374,13 @@ ...@@ -4374,13 +4374,13 @@
prorettype => 'text', proargtypes => 'text', prosrc => 'text_format_nv' }, prorettype => 'text', proargtypes => 'text', prosrc => 'text_format_nv' },
{ oid => '1810', descr => 'length in bits', { oid => '1810', descr => 'length in bits',
proname => 'bit_length', prolang => '14', prorettype => 'int4', proname => 'bit_length', prolang => 'sql', prorettype => 'int4',
proargtypes => 'bytea', prosrc => 'select pg_catalog.octet_length($1) * 8' }, proargtypes => 'bytea', prosrc => 'select pg_catalog.octet_length($1) * 8' },
{ oid => '1811', descr => 'length in bits', { oid => '1811', descr => 'length in bits',
proname => 'bit_length', prolang => '14', prorettype => 'int4', proname => 'bit_length', prolang => 'sql', prorettype => 'int4',
proargtypes => 'text', prosrc => 'select pg_catalog.octet_length($1) * 8' }, proargtypes => 'text', prosrc => 'select pg_catalog.octet_length($1) * 8' },
{ oid => '1812', descr => 'length in bits', { oid => '1812', descr => 'length in bits',
proname => 'bit_length', prolang => '14', prorettype => 'int4', proname => 'bit_length', prolang => 'sql', prorettype => 'int4',
proargtypes => 'bit', prosrc => 'select pg_catalog.length($1)' }, proargtypes => 'bit', prosrc => 'select pg_catalog.length($1)' },
# Selectivity estimators for LIKE and related operators # Selectivity estimators for LIKE and related operators
...@@ -4699,7 +4699,7 @@ ...@@ -4699,7 +4699,7 @@
prosrc => 'to_ascii_encname' }, prosrc => 'to_ascii_encname' },
{ oid => '1848', { oid => '1848',
proname => 'interval_pl_time', prolang => '14', prorettype => 'time', proname => 'interval_pl_time', prolang => 'sql', prorettype => 'time',
proargtypes => 'interval time', prosrc => 'select $2 + $1' }, proargtypes => 'interval time', prosrc => 'select $2 + $1' },
{ oid => '1850', { oid => '1850',
...@@ -5479,11 +5479,11 @@ ...@@ -5479,11 +5479,11 @@
proargtypes => 'timetz int4', prosrc => 'timetz_scale' }, proargtypes => 'timetz int4', prosrc => 'timetz_scale' },
{ oid => '2003', { oid => '2003',
proname => 'textanycat', prolang => '14', provolatile => 's', proname => 'textanycat', prolang => 'sql', provolatile => 's',
prorettype => 'text', proargtypes => 'text anynonarray', prorettype => 'text', proargtypes => 'text anynonarray',
prosrc => 'select $1 || $2::pg_catalog.text' }, prosrc => 'select $1 || $2::pg_catalog.text' },
{ oid => '2004', { oid => '2004',
proname => 'anytextcat', prolang => '14', provolatile => 's', proname => 'anytextcat', prolang => 'sql', provolatile => 's',
prorettype => 'text', proargtypes => 'anynonarray text', prorettype => 'text', proargtypes => 'anynonarray text',
prosrc => 'select $1::pg_catalog.text || $2' }, prosrc => 'select $1::pg_catalog.text || $2' },
...@@ -5583,15 +5583,15 @@ ...@@ -5583,15 +5583,15 @@
proargtypes => 'timestamp timestamp timestamp timestamp', proargtypes => 'timestamp timestamp timestamp timestamp',
prosrc => 'overlaps_timestamp' }, prosrc => 'overlaps_timestamp' },
{ oid => '2042', descr => 'intervals overlap?', { oid => '2042', descr => 'intervals overlap?',
proname => 'overlaps', prolang => '14', proisstrict => 'f', proname => 'overlaps', prolang => 'sql', proisstrict => 'f',
prorettype => 'bool', proargtypes => 'timestamp interval timestamp interval', prorettype => 'bool', proargtypes => 'timestamp interval timestamp interval',
prosrc => 'select ($1, ($1 + $2)) overlaps ($3, ($3 + $4))' }, prosrc => 'select ($1, ($1 + $2)) overlaps ($3, ($3 + $4))' },
{ oid => '2043', descr => 'intervals overlap?', { oid => '2043', descr => 'intervals overlap?',
proname => 'overlaps', prolang => '14', proisstrict => 'f', proname => 'overlaps', prolang => 'sql', proisstrict => 'f',
prorettype => 'bool', proargtypes => 'timestamp timestamp timestamp interval', prorettype => 'bool', proargtypes => 'timestamp timestamp timestamp interval',
prosrc => 'select ($1, $2) overlaps ($3, ($3 + $4))' }, prosrc => 'select ($1, $2) overlaps ($3, ($3 + $4))' },
{ oid => '2044', descr => 'intervals overlap?', { oid => '2044', descr => 'intervals overlap?',
proname => 'overlaps', prolang => '14', proisstrict => 'f', proname => 'overlaps', prolang => 'sql', proisstrict => 'f',
prorettype => 'bool', proargtypes => 'timestamp interval timestamp timestamp', prorettype => 'bool', proargtypes => 'timestamp interval timestamp timestamp',
prosrc => 'select ($1, ($1 + $2)) overlaps ($3, $4)' }, prosrc => 'select ($1, ($1 + $2)) overlaps ($3, $4)' },
{ oid => '2045', descr => 'less-equal-greater', { oid => '2045', descr => 'less-equal-greater',
...@@ -5657,7 +5657,7 @@ ...@@ -5657,7 +5657,7 @@
proargtypes => 'timestamp timestamp', prosrc => 'timestamp_age' }, proargtypes => 'timestamp timestamp', prosrc => 'timestamp_age' },
{ oid => '2059', { oid => '2059',
descr => 'date difference from today preserving months and years', descr => 'date difference from today preserving months and years',
proname => 'age', prolang => '14', provolatile => 's', proname => 'age', prolang => 'sql', provolatile => 's',
prorettype => 'interval', proargtypes => 'timestamp', prorettype => 'interval', proargtypes => 'timestamp',
prosrc => 'select pg_catalog.age(cast(current_date as timestamp without time zone), $1)' }, prosrc => 'select pg_catalog.age(cast(current_date as timestamp without time zone), $1)' },
...@@ -5680,7 +5680,7 @@ ...@@ -5680,7 +5680,7 @@
proname => 'substring', prorettype => 'text', proargtypes => 'text text', proname => 'substring', prorettype => 'text', proargtypes => 'text text',
prosrc => 'textregexsubstr' }, prosrc => 'textregexsubstr' },
{ oid => '2074', descr => 'extract text matching SQL99 regular expression', { oid => '2074', descr => 'extract text matching SQL99 regular expression',
proname => 'substring', prolang => '14', prorettype => 'text', proname => 'substring', prolang => 'sql', prorettype => 'text',
proargtypes => 'text text text', proargtypes => 'text text text',
prosrc => 'select pg_catalog.substring($1, pg_catalog.similar_escape($2, $3))' }, prosrc => 'select pg_catalog.substring($1, pg_catalog.similar_escape($2, $3))' },
...@@ -6019,11 +6019,11 @@ ...@@ -6019,11 +6019,11 @@
proname => 'pg_sleep', provolatile => 'v', prorettype => 'void', proname => 'pg_sleep', provolatile => 'v', prorettype => 'void',
proargtypes => 'float8', prosrc => 'pg_sleep' }, proargtypes => 'float8', prosrc => 'pg_sleep' },
{ oid => '3935', descr => 'sleep for the specified interval', { oid => '3935', descr => 'sleep for the specified interval',
proname => 'pg_sleep_for', prolang => '14', provolatile => 'v', proname => 'pg_sleep_for', prolang => 'sql', provolatile => 'v',
prorettype => 'void', proargtypes => 'interval', prorettype => 'void', proargtypes => 'interval',
prosrc => 'select pg_catalog.pg_sleep(extract(epoch from pg_catalog.clock_timestamp() operator(pg_catalog.+) $1) operator(pg_catalog.-) extract(epoch from pg_catalog.clock_timestamp()))' }, prosrc => 'select pg_catalog.pg_sleep(extract(epoch from pg_catalog.clock_timestamp() operator(pg_catalog.+) $1) operator(pg_catalog.-) extract(epoch from pg_catalog.clock_timestamp()))' },
{ oid => '3936', descr => 'sleep until the specified time', { oid => '3936', descr => 'sleep until the specified time',
proname => 'pg_sleep_until', prolang => '14', provolatile => 'v', proname => 'pg_sleep_until', prolang => 'sql', provolatile => 'v',
prorettype => 'void', proargtypes => 'timestamptz', prorettype => 'void', proargtypes => 'timestamptz',
prosrc => 'select pg_catalog.pg_sleep(extract(epoch from $1) operator(pg_catalog.-) extract(epoch from pg_catalog.clock_timestamp()))' }, prosrc => 'select pg_catalog.pg_sleep(extract(epoch from $1) operator(pg_catalog.-) extract(epoch from pg_catalog.clock_timestamp()))' },
{ oid => '315', descr => 'Is JIT compilation available in this session?', { oid => '315', descr => 'Is JIT compilation available in this session?',
...@@ -6818,7 +6818,7 @@ ...@@ -6818,7 +6818,7 @@
proargtypes => 'name', prosrc => 'pg_database_size_name' }, proargtypes => 'name', prosrc => 'pg_database_size_name' },
{ oid => '2325', { oid => '2325',
descr => 'disk space usage for the main fork of the specified table or index', descr => 'disk space usage for the main fork of the specified table or index',
proname => 'pg_relation_size', prolang => '14', provolatile => 'v', proname => 'pg_relation_size', prolang => 'sql', provolatile => 'v',
prorettype => 'int8', proargtypes => 'regclass', prorettype => 'int8', proargtypes => 'regclass',
prosrc => 'select pg_catalog.pg_relation_size($1, \'main\')' }, prosrc => 'select pg_catalog.pg_relation_size($1, \'main\')' },
{ oid => '2332', { oid => '2332',
...@@ -7639,21 +7639,21 @@ ...@@ -7639,21 +7639,21 @@
# formerly-missing interval + datetime operators # formerly-missing interval + datetime operators
{ oid => '2546', { oid => '2546',
proname => 'interval_pl_date', prolang => '14', prorettype => 'timestamp', proname => 'interval_pl_date', prolang => 'sql', prorettype => 'timestamp',
proargtypes => 'interval date', prosrc => 'select $2 + $1' }, proargtypes => 'interval date', prosrc => 'select $2 + $1' },
{ oid => '2547', { oid => '2547',
proname => 'interval_pl_timetz', prolang => '14', prorettype => 'timetz', proname => 'interval_pl_timetz', prolang => 'sql', prorettype => 'timetz',
proargtypes => 'interval timetz', prosrc => 'select $2 + $1' }, proargtypes => 'interval timetz', prosrc => 'select $2 + $1' },
{ oid => '2548', { oid => '2548',
proname => 'interval_pl_timestamp', prolang => '14', proname => 'interval_pl_timestamp', prolang => 'sql',
prorettype => 'timestamp', proargtypes => 'interval timestamp', prorettype => 'timestamp', proargtypes => 'interval timestamp',
prosrc => 'select $2 + $1' }, prosrc => 'select $2 + $1' },
{ oid => '2549', { oid => '2549',
proname => 'interval_pl_timestamptz', prolang => '14', provolatile => 's', proname => 'interval_pl_timestamptz', prolang => 'sql', provolatile => 's',
prorettype => 'timestamptz', proargtypes => 'interval timestamptz', prorettype => 'timestamptz', proargtypes => 'interval timestamptz',
prosrc => 'select $2 + $1' }, prosrc => 'select $2 + $1' },
{ oid => '2550', { oid => '2550',
proname => 'integer_pl_date', prolang => '14', prorettype => 'date', proname => 'integer_pl_date', prolang => 'sql', prorettype => 'date',
proargtypes => 'int4 date', prosrc => 'select $2 + $1' }, proargtypes => 'int4 date', prosrc => 'select $2 + $1' },
{ oid => '2556', descr => 'get OIDs of databases in a tablespace', { oid => '2556', descr => 'get OIDs of databases in a tablespace',
...@@ -8038,7 +8038,7 @@ ...@@ -8038,7 +8038,7 @@
proname => 'xpath', prorettype => '_xml', proargtypes => 'text xml _text', proname => 'xpath', prorettype => '_xml', proargtypes => 'text xml _text',
prosrc => 'xpath' }, prosrc => 'xpath' },
{ oid => '2932', descr => 'evaluate XPath expression', { oid => '2932', descr => 'evaluate XPath expression',
proname => 'xpath', prolang => '14', prorettype => '_xml', proname => 'xpath', prolang => 'sql', prorettype => '_xml',
proargtypes => 'text xml', proargtypes => 'text xml',
prosrc => 'select pg_catalog.xpath($1, $2, \'{}\'::pg_catalog.text[])' }, prosrc => 'select pg_catalog.xpath($1, $2, \'{}\'::pg_catalog.text[])' },
...@@ -8051,7 +8051,7 @@ ...@@ -8051,7 +8051,7 @@
proname => 'xpath_exists', prorettype => 'bool', proname => 'xpath_exists', prorettype => 'bool',
proargtypes => 'text xml _text', prosrc => 'xpath_exists' }, proargtypes => 'text xml _text', prosrc => 'xpath_exists' },
{ oid => '3050', descr => 'test XML value against XPath expression', { oid => '3050', descr => 'test XML value against XPath expression',
proname => 'xpath_exists', prolang => '14', prorettype => 'bool', proname => 'xpath_exists', prolang => 'sql', prorettype => 'bool',
proargtypes => 'text xml', proargtypes => 'text xml',
prosrc => 'select pg_catalog.xpath_exists($1, $2, \'{}\'::pg_catalog.text[])' }, prosrc => 'select pg_catalog.xpath_exists($1, $2, \'{}\'::pg_catalog.text[])' },
{ oid => '3051', descr => 'determine if a string is well formed XML', { oid => '3051', descr => 'determine if a string is well formed XML',
......
...@@ -42,7 +42,7 @@ CATALOG(pg_proc,1255,ProcedureRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(81,Proce ...@@ -42,7 +42,7 @@ CATALOG(pg_proc,1255,ProcedureRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(81,Proce
Oid proowner BKI_DEFAULT(PGUID); Oid proowner BKI_DEFAULT(PGUID);
/* OID of pg_language entry */ /* OID of pg_language entry */
Oid prolang BKI_DEFAULT(12); Oid prolang BKI_DEFAULT(internal) BKI_LOOKUP(pg_language);
/* estimated execution cost */ /* estimated execution cost */
float4 procost BKI_DEFAULT(1); float4 procost BKI_DEFAULT(1);
......
...@@ -269,16 +269,14 @@ sub GenerateFiles ...@@ -269,16 +269,14 @@ sub GenerateFiles
"LIBPGTYPES"); "LIBPGTYPES");
chdir('src/backend/utils'); chdir('src/backend/utils');
my $pg_language_dat = '../../../src/include/catalog/pg_language.dat';
my $pg_proc_dat = '../../../src/include/catalog/pg_proc.dat'; my $pg_proc_dat = '../../../src/include/catalog/pg_proc.dat';
if ( IsNewer('fmgr-stamp', 'Gen_fmgrtab.pl') if ( IsNewer('fmgr-stamp', 'Gen_fmgrtab.pl')
|| IsNewer('fmgr-stamp', '../catalog/Catalog.pm') || IsNewer('fmgr-stamp', '../catalog/Catalog.pm')
|| IsNewer('fmgr-stamp', $pg_language_dat)
|| IsNewer('fmgr-stamp', $pg_proc_dat) || IsNewer('fmgr-stamp', $pg_proc_dat)
|| IsNewer('fmgr-stamp', '../../../src/include/access/transam.h')) || IsNewer('fmgr-stamp', '../../../src/include/access/transam.h'))
{ {
system( system(
"perl -I ../catalog Gen_fmgrtab.pl -I../../../src/include/ $pg_language_dat $pg_proc_dat" "perl -I ../catalog Gen_fmgrtab.pl -I../../../src/include/ $pg_proc_dat"
); );
open(my $f, '>', 'fmgr-stamp') open(my $f, '>', 'fmgr-stamp')
|| confess "Could not touch fmgr-stamp"; || confess "Could not touch fmgr-stamp";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment