Skip to content

Commit bff5dce

Browse files
committed
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 ...
1 parent 6437fe6 commit bff5dce

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

src/backend/utils/Gen_fmgrtab.sh.in

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#
1010
#
1111
# IDENTIFICATION
12-
# $Header: /cvsroot/pgsql/src/backend/utils/Attic/Gen_fmgrtab.sh.in,v 1.23 2000/05/29 20:18:30 tgl Exp $
12+
# $Header: /cvsroot/pgsql/src/backend/utils/Attic/Gen_fmgrtab.sh.in,v 1.24 2000/06/02 02:00:28 tgl Exp $
1313
#
1414
# NOTES
1515
# Passes any -D options on to cpp prior to generating the list
@@ -82,7 +82,7 @@ cat > $OIDSFILE <<FuNkYfMgRsTuFf
8282
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
8383
* Portions Copyright (c) 1994, Regents of the University of California
8484
*
85-
* $Id: Gen_fmgrtab.sh.in,v 1.23 2000/05/29 20:18:30 tgl Exp $
85+
* $Id: Gen_fmgrtab.sh.in,v 1.24 2000/06/02 02:00:28 tgl Exp $
8686
*
8787
* NOTES
8888
* ******************************
@@ -105,8 +105,8 @@ cat > $OIDSFILE <<FuNkYfMgRsTuFf
105105
* For example, we want to be able to assign different macro names to both
106106
* char_text() and int4_text() even though these both appear with proname
107107
* 'text'. If the same C function appears in more than one pg_proc entry,
108-
* its equivalent macro will be defined with the OID of the entry appearing
109-
* first in pg_proc.h.
108+
* its equivalent macro will be defined with the lowest OID among those
109+
* entries.
110110
*/
111111
FuNkYfMgRsTuFf
112112

@@ -139,7 +139,7 @@ cat > $TABLEFILE <<FuNkYfMgRtAbStUfF
139139
* Portions Copyright (c) 1994, Regents of the University of California
140140
*
141141
* IDENTIFICATION
142-
* $Header: /cvsroot/pgsql/src/backend/utils/Attic/Gen_fmgrtab.sh.in,v 1.23 2000/05/29 20:18:30 tgl Exp $
142+
* $Header: /cvsroot/pgsql/src/backend/utils/Attic/Gen_fmgrtab.sh.in,v 1.24 2000/06/02 02:00:28 tgl Exp $
143143
*
144144
* NOTES
145145
*
@@ -170,11 +170,19 @@ cat >> $TABLEFILE <<FuNkYfMgRtAbStUfF
170170
const FmgrBuiltin fmgr_builtins[] = {
171171
FuNkYfMgRtAbStUfF
172172

173-
awk '{ printf (" { %d, \"%s\", %d, %s, %s, %s },\n"), \
174-
$1, $(NF-1), $9, \
175-
($8 == "t") ? "true" : "false", \
176-
($4 == "11") ? "true" : "false", \
177-
$(NF-1) }' $RAWFILE >> $TABLEFILE
173+
# Note: using awk arrays to translate from pg_proc values to fmgrtab values
174+
# may seem tedious, but avoid the temptation to write a quick x?y:z
175+
# conditional expression instead. Not all awks have conditional expressions.
176+
177+
awk 'BEGIN {
178+
Strict["t"] = "true"
179+
Strict["f"] = "false"
180+
OldStyle["11"] = "true"
181+
OldStyle["12"] = "false"
182+
}
183+
{ printf (" { %d, \"%s\", %d, %s, %s, %s },\n"), \
184+
$1, $(NF-1), $9, Strict[$8], OldStyle[$4], $(NF-1)
185+
}' $RAWFILE >> $TABLEFILE
178186

179187
cat >> $TABLEFILE <<FuNkYfMgRtAbStUfF
180188
/* dummy entry is easier than getting rid of comma after last real one */

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy