Tweak fmgrtab generation so that the F_XXX macros that give OIDs for

built-in procedures are named after the prosrc field of pg_proc (ie,
the actual C function name), not the proname field.  This did not use
to make a difference back when the two were always the same, but in the
presence of overloaded proname values we'd best try to use the C name
instead.  AFAICT this change affects no existing code, but it is
necessary to be able to get at some built-in functions that no macro
was being generated for before.
This commit is contained in:
Tom Lane 2000-05-29 20:18:30 +00:00
parent 22a517a40c
commit a030113197
1 changed files with 13 additions and 8 deletions

View File

@ -9,7 +9,7 @@
# #
# #
# IDENTIFICATION # IDENTIFICATION
# $Header: /cvsroot/pgsql/src/backend/utils/Attic/Gen_fmgrtab.sh.in,v 1.22 2000/05/28 17:56:05 tgl Exp $ # $Header: /cvsroot/pgsql/src/backend/utils/Attic/Gen_fmgrtab.sh.in,v 1.23 2000/05/29 20:18:30 tgl Exp $
# #
# NOTES # NOTES
# Passes any -D options on to cpp prior to generating the list # Passes any -D options on to cpp prior to generating the list
@ -41,7 +41,7 @@ TABLEFILE=fmgrtab.c
# #
# Generate the file containing raw pg_proc tuple data # Generate the file containing raw pg_proc tuple data
# (but only for "internal" language procedures...). # (but only for "internal" and "newinternal" language procedures...).
# #
# Unlike genbki.sh, which can run through cpp last, we have to # Unlike genbki.sh, which can run through cpp last, we have to
# deal with preprocessor statements first (before we sort the # deal with preprocessor statements first (before we sort the
@ -82,7 +82,7 @@ cat > $OIDSFILE <<FuNkYfMgRsTuFf
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: Gen_fmgrtab.sh.in,v 1.22 2000/05/28 17:56:05 tgl Exp $ * $Id: Gen_fmgrtab.sh.in,v 1.23 2000/05/29 20:18:30 tgl Exp $
* *
* NOTES * NOTES
* ****************************** * ******************************
@ -99,16 +99,21 @@ cat > $OIDSFILE <<FuNkYfMgRsTuFf
/* /*
* Constant macros for the OIDs of entries in pg_proc. * Constant macros for the OIDs of entries in pg_proc.
* NOTE: if the same "proname" is used for more than one *
* internal-function entry in pg_proc, the equivalent macro * NOTE: macros are named after the prosrc value, ie the actual C name
* will be defined with the lowest OID among those entries. * of the implementing function, not the proname which may be overloaded.
* For example, we want to be able to assign different macro names to both
* char_text() and int4_text() even though these both appear with proname
* 'text'. If the same C function appears in more than one pg_proc entry,
* its equivalent macro will be defined with the OID of the entry appearing
* first in pg_proc.h.
*/ */
FuNkYfMgRsTuFf FuNkYfMgRsTuFf
tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' < $RAWFILE | \ tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' < $RAWFILE | \
awk ' awk '
BEGIN { OFS = ""; } BEGIN { OFS = ""; }
{ if (seenit[$2]++ == 0) print "#define F_", $2, " ", $1; }' >> $OIDSFILE { if (seenit[$(NF-1)]++ == 0) print "#define F_", $(NF-1), " ", $1; }' >> $OIDSFILE
cat >> $OIDSFILE <<FuNkYfMgRsTuFf cat >> $OIDSFILE <<FuNkYfMgRsTuFf
@ -134,7 +139,7 @@ cat > $TABLEFILE <<FuNkYfMgRtAbStUfF
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/Attic/Gen_fmgrtab.sh.in,v 1.22 2000/05/28 17:56:05 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/Attic/Gen_fmgrtab.sh.in,v 1.23 2000/05/29 20:18:30 tgl Exp $
* *
* NOTES * NOTES
* *