summaryrefslogtreecommitdiff
path: root/src/bin/initdb/initdb.c
diff options
context:
space:
mode:
authorTom Lane2008-07-19 04:01:29 +0000
committerTom Lane2008-07-19 04:01:29 +0000
commit4b362c662e35c0edd6ed66523f94ebfe9f466329 (patch)
treef6afb196f699504ab970e2102645dcf49def8f10 /src/bin/initdb/initdb.c
parenta1c692358bb9958b7cb67e4284aae6aa3aabf714 (diff)
Avoid substituting NAMEDATALEN, FLOAT4PASSBYVAL, and FLOAT8PASSBYVAL into
the postgres.bki file during build, because we want that file to be entirely platform- and configuration-independent; else it can't safely be put into /usr/share on multiarch machines. We can do the substitution during initdb, instead. FLOAT4PASSBYVAL and FLOAT8PASSBYVAL are new breakage as of 8.4, while the NAMEDATALEN hazard has been there all along but I guess no one tripped over it. Noticed while trying to build "universal" OS X binaries.
Diffstat (limited to 'src/bin/initdb/initdb.c')
-rw-r--r--src/bin/initdb/initdb.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index cc2ea273ea5..a7ef3c9227d 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -42,7 +42,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
* Portions taken from FreeBSD.
*
- * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.157 2008/06/26 01:35:45 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.158 2008/07/19 04:01:29 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1313,6 +1313,7 @@ bootstrap_template1(char *short_version)
char *talkargs = "";
char **bki_lines;
char headerline[MAXPGPATH];
+ char buf[64];
printf(_("creating template1 database in %s/base/1 ... "), pg_data);
fflush(stdout);
@@ -1337,6 +1338,17 @@ bootstrap_template1(char *short_version)
exit_nicely();
}
+ /* Substitute for various symbols used in the BKI file */
+
+ sprintf(buf, "%d", NAMEDATALEN);
+ bki_lines = replace_token(bki_lines, "NAMEDATALEN", buf);
+
+ bki_lines = replace_token(bki_lines, "FLOAT4PASSBYVAL",
+ FLOAT4PASSBYVAL ? "true" : "false");
+
+ bki_lines = replace_token(bki_lines, "FLOAT8PASSBYVAL",
+ FLOAT8PASSBYVAL ? "true" : "false");
+
bki_lines = replace_token(bki_lines, "POSTGRES", username);
bki_lines = replace_token(bki_lines, "ENCODING", encodingid);