postgresql: Enable package
[termux-packages] / packages / postgresql / src-bin-initdb-initdb.c.patch
CommitLineData
826f3f28
FF
1diff -u -r ../postgresql-9.6.2/src/bin/initdb/initdb.c ./src/bin/initdb/initdb.c
2--- ../postgresql-9.6.2/src/bin/initdb/initdb.c 2017-02-06 22:45:25.000000000 +0100
3+++ ./src/bin/initdb/initdb.c 2017-03-05 14:41:04.690265407 +0100
4@@ -122,8 +122,8 @@
5
6 /* values to be obtained from arguments */
7 static char *pg_data = "";
8-static char *encoding = "";
9-static char *locale = "";
10+static char *encoding = "UTF-8";
11+static char *locale = "en_US.UTF-8";
12 static char *lc_collate = "";
13 static char *lc_ctype = "";
14 static char *lc_monetary = "";
15@@ -1848,6 +1848,7 @@
16 setup_collation(FILE *cmdfd)
17 {
18 #if defined(HAVE_LOCALE_T) && !defined(WIN32)
19+#ifndef __ANDROID__
20 int i;
21 FILE *locale_a_handle;
22 char localebuf[NAMEDATALEN]; /* we assume ASCII so this is fine */
23@@ -1856,12 +1857,14 @@
24 locale_a_handle = popen_check("locale -a", "r");
25 if (!locale_a_handle)
26 return; /* complaint already printed */
27+#endif
28
29 PG_CMD_PUTS("CREATE TEMP TABLE tmp_pg_collation ( "
30 " collname name, "
31 " locale name, "
32 " encoding int) WITHOUT OIDS;\n\n");
33
34+#ifndef __ANDROID__
35 while (fgets(localebuf, sizeof(localebuf), locale_a_handle))
36 {
37 size_t len;
38@@ -1938,6 +1941,7 @@
39 }
40 free(quoted_locale);
41 }
42+#endif
43
44 /* Add an SQL-standard name */
45 PG_CMD_PRINTF1("INSERT INTO tmp_pg_collation VALUES ('ucs_basic', 'C', %d);\n\n", PG_UTF8);
46@@ -1969,6 +1973,7 @@
47 */
48 PG_CMD_PUTS("DROP TABLE tmp_pg_collation;\n\n");
49
50+#ifndef __ANDROID__
51 pclose(locale_a_handle);
52
53 if (count == 0 && !debug)
54@@ -1976,6 +1981,7 @@
55 printf(_("No usable system locales were found.\n"));
56 printf(_("Use the option \"--debug\" to see details.\n"));
57 }
58+#endif
59 #endif /* not HAVE_LOCALE_T && not WIN32 */
60 }
61