Skip to content

Commit 57c9e75

Browse files
committed
wasi test
1 parent 2db55f9 commit 57c9e75

File tree

3 files changed

+281
-142
lines changed

3 files changed

+281
-142
lines changed

patches-REL_17_5_WASM/postgresql-wasi/src-bin-pg_dump-pg_dump.c.diff

Lines changed: 57 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,69 @@
11
--- REL_17_5_WASM/src/bin/pg_dump/pg_dump.c
22
+++ pglite-REL_17_5_WASM/src/bin/pg_dump/pg_dump.c
3-
@@ -843,12 +843,12 @@
3+
@@ -30,13 +30,6 @@
4+
*-------------------------------------------------------------------------
5+
*/
6+
#include "postgres_fe.h"
7+
-#if !defined(__EMSCRIPTEN__) && !defined(__wasi__)
8+
-#ifdef quote_all_identifiers
9+
-#undef quote_all_identifiers
10+
-#endif
11+
-#define fe_utils_quote_all_identifiers quote_all_identifiers
12+
-static bool quote_all_identifiers;
13+
-#endif
14+
15+
#include <unistd.h>
16+
#include <ctype.h>
17+
@@ -432,7 +425,7 @@
18+
{"lock-wait-timeout", required_argument, NULL, 2},
19+
{"no-table-access-method", no_argument, &dopt.outputNoTableAm, 1},
20+
{"no-tablespaces", no_argument, &dopt.outputNoTablespaces, 1},
21+
- {"quote-all-identifiers", no_argument, &fe_utils_quote_all_identifiers, true},
22+
+ {"quote-all-identifiers", no_argument, &fe_utils_quote_all_identifiers, 1},
23+
{"load-via-partition-root", no_argument, &dopt.load_via_partition_root, 1},
24+
{"role", required_argument, NULL, 3},
25+
{"section", required_argument, NULL, 5},
26+
@@ -459,9 +452,7 @@
27+
28+
{NULL, 0, NULL, 0}
29+
};
30+
-#if defined(__wasi__)
31+
-chdir("/");
32+
-#endif
33+
+
34+
pg_logging_init(argv[0]);
35+
pg_logging_set_level(PG_LOG_WARNING);
36+
set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pg_dump"));
37+
@@ -838,17 +829,15 @@
38+
fout->maxRemoteVersion = (PG_VERSION_NUM / 100) * 100 + 99;
39+
40+
fout->numWorkers = numWorkers;
41+
-
42+
+puts("# 832:" __FILE__ ": ConnectDatabase\r\n");
43+
/*
444
* Open the database using the Archiver, so it knows about it. Errors mean
545
* death.
646
*/
7-
-puts("# 813 : " __FILE__);
8-
+puts("# 813 : " __FILE__ "\r\n");
9-
//setup();
47+
-puts("# 813 : " __FILE__ "\r\n");
48+
- //setup();
1049
ConnectDatabase(fout, &dopt.cparams, false);
11-
-puts("# 815 : " __FILE__);
12-
+puts("# 815 : " __FILE__ "\r\n");
50+
-puts("# 815 : " __FILE__ "\r\n");
51+
+puts("# 838:" __FILE__ ": ConnectDatabase->setup_connection\r\n");
1352
setup_connection(fout, dumpencoding, dumpsnapshot, use_role);
14-
-puts("# 817 : " __FILE__);
15-
+puts("# 817 : " __FILE__ "\r\n");
53+
-puts("# 817 : " __FILE__ "\r\n");
54+
+
1655
/*
1756
* On hot standbys, never try to dump unlogged table data, since it will
1857
* just throw an error.
19-
@@ -1295,7 +1295,7 @@
20-
* Quote all identifiers, if requested.
21-
*/
22-
if (fe_utils_quote_all_identifiers)
23-
- ExecuteSqlStatement(AH, "SET fe_utils_quote_all_identifiers = true");
24-
+ ExecuteSqlStatement(AH, "SET quote_all_identifiers = true");
58+
@@ -1203,10 +1192,9 @@
59+
const char *dumpsnapshot, char *use_role)
60+
{
61+
DumpOptions *dopt = AH->dopt;
62+
-puts("# 1206 : get_connection : "__FILE__);
63+
PGconn *conn = GetConnection(AH);
64+
const char *std_strings;
65+
-puts("# 1209 : setup_connection");
66+
+
67+
PQclear(ExecuteSqlQueryForSingleRow(AH, ALWAYS_SECURE_SEARCH_PATH_SQL));
2568

2669
/*
27-
* Adjust row-security mode, if supported.

0 commit comments

Comments
 (0)