aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2000-06-02 02:00:28 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2000-06-02 02:00:28 +0000
commitbff5dce9939cdf38b4b7b9f6b1e70672d25aae3c (patch)
tree3bbeb499729c7f0701066dcdf2eec29ffef6af39
parent6437fe62ba298ed233f3c96c634e3c1408bb3def (diff)
downloadpostgresql-bff5dce9939cdf38b4b7b9f6b1e70672d25aae3c.tar.gz
postgresql-bff5dce9939cdf38b4b7b9f6b1e70672d25aae3c.zip
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 ...
-rw-r--r--src/backend/utils/Gen_fmgrtab.sh.in28
1 files changed, 18 insertions, 10 deletions
diff --git a/src/backend/utils/Gen_fmgrtab.sh.in b/src/backend/utils/Gen_fmgrtab.sh.in
index 7b8dd1a9b90..bc6edf9019a 100644
--- a/src/backend/utils/Gen_fmgrtab.sh.in
+++ b/src/backend/utils/Gen_fmgrtab.sh.in
@@ -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 */