Correct portability problem introduced by yours truly --- I used a

conditional expression x?y:z in an awk program.  Seems old versions
of awk don't have that ...
This commit is contained in:
Tom Lane 2000-06-02 02:00:28 +00:00
parent 6437fe62ba
commit bff5dce993
1 changed files with 18 additions and 10 deletions

View File

@ -9,7 +9,7 @@
#
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/backend/utils/Attic/Gen_fmgrtab.sh.in,v 1.23 2000/05/29 20:18:30 tgl Exp $
# $Header: /cvsroot/pgsql/src/backend/utils/Attic/Gen_fmgrtab.sh.in,v 1.24 2000/06/02 02:00:28 tgl Exp $
#
# NOTES
# Passes any -D options on to cpp prior to generating the list
@ -82,7 +82,7 @@ cat > $OIDSFILE <<FuNkYfMgRsTuFf
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: Gen_fmgrtab.sh.in,v 1.23 2000/05/29 20:18:30 tgl Exp $
* $Id: Gen_fmgrtab.sh.in,v 1.24 2000/06/02 02:00:28 tgl Exp $
*
* NOTES
* ******************************
@ -105,8 +105,8 @@ cat > $OIDSFILE <<FuNkYfMgRsTuFf
* 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.
* its equivalent macro will be defined with the lowest OID among those
* entries.
*/
FuNkYfMgRsTuFf
@ -139,7 +139,7 @@ cat > $TABLEFILE <<FuNkYfMgRtAbStUfF
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/Attic/Gen_fmgrtab.sh.in,v 1.23 2000/05/29 20:18:30 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/Attic/Gen_fmgrtab.sh.in,v 1.24 2000/06/02 02:00:28 tgl Exp $
*
* NOTES
*
@ -170,11 +170,19 @@ cat >> $TABLEFILE <<FuNkYfMgRtAbStUfF
const FmgrBuiltin fmgr_builtins[] = {
FuNkYfMgRtAbStUfF
awk '{ printf (" { %d, \"%s\", %d, %s, %s, %s },\n"), \
$1, $(NF-1), $9, \
($8 == "t") ? "true" : "false", \
($4 == "11") ? "true" : "false", \
$(NF-1) }' $RAWFILE >> $TABLEFILE
# Note: using awk arrays to translate from pg_proc values to fmgrtab values
# may seem tedious, but avoid the temptation to write a quick x?y:z
# conditional expression instead. Not all awks have conditional expressions.
awk 'BEGIN {
Strict["t"] = "true"
Strict["f"] = "false"
OldStyle["11"] = "true"
OldStyle["12"] = "false"
}
{ printf (" { %d, \"%s\", %d, %s, %s, %s },\n"), \
$1, $(NF-1), $9, Strict[$8], OldStyle[$4], $(NF-1)
}' $RAWFILE >> $TABLEFILE
cat >> $TABLEFILE <<FuNkYfMgRtAbStUfF
/* dummy entry is easier than getting rid of comma after last real one */