=== Applying patches on top of PostgreSQL commit ID 5941946d0934b9eccb0d5bfebd40b155249a0130 === /etc/rc.d/jail: WARNING: Per-jail configuration via jail_* variables is obsolete. Please consider migrating to /etc/jail.conf. Thu Mar 20 01:04:21 UTC 2025 On branch cf/5525 nothing to commit, working tree clean === using 'git am' to apply patch ./0001-enable-fetching-explain-plans-from-foreign-server.patch === Applying: enable fetching explain plans from foreign server .git/rebase-apply/patch:285: trailing whitespace. static void .git/rebase-apply/patch:352: trailing whitespace. } .git/rebase-apply/patch:668: trailing whitespace. .git/rebase-apply/patch:718: indent with spaces. DefineCustomBoolVariable("postgres_fdw.auto_explain_enabled", .git/rebase-apply/patch:816: trailing whitespace. NULL); warning: squelched 5 whitespace errors warning: 10 lines add whitespace errors. Using index info to reconstruct a base tree... M contrib/postgres_fdw/Makefile M contrib/postgres_fdw/connection.c M contrib/postgres_fdw/expected/postgres_fdw.out M contrib/postgres_fdw/option.c M contrib/postgres_fdw/postgres_fdw.c M contrib/postgres_fdw/postgres_fdw.h M contrib/postgres_fdw/sql/postgres_fdw.sql M src/backend/commands/explain.c M src/include/commands/explain.h Falling back to patching base and 3-way merge... Auto-merging src/include/commands/explain.h Auto-merging src/backend/commands/explain.c CONFLICT (content): Merge conflict in src/backend/commands/explain.c Auto-merging contrib/postgres_fdw/sql/postgres_fdw.sql Auto-merging contrib/postgres_fdw/postgres_fdw.h Auto-merging contrib/postgres_fdw/postgres_fdw.c Auto-merging contrib/postgres_fdw/option.c Auto-merging contrib/postgres_fdw/expected/postgres_fdw.out Auto-merging contrib/postgres_fdw/connection.c Auto-merging contrib/postgres_fdw/Makefile error: Failed to merge in the changes. hint: Use 'git am --show-current-patch=diff' to see the failed patch Patch failed at 0001 enable fetching explain plans from foreign server When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort". Unstaged changes after reset: M contrib/postgres_fdw/Makefile M contrib/postgres_fdw/connection.c M contrib/postgres_fdw/expected/postgres_fdw.out M contrib/postgres_fdw/option.c M contrib/postgres_fdw/postgres_fdw.c M contrib/postgres_fdw/postgres_fdw.h M contrib/postgres_fdw/sql/postgres_fdw.sql M src/backend/commands/explain.c M src/include/commands/explain.h Removing contrib/postgres_fdw/postgres_fdw_auto_explain.c Removing src/include/pg_config_ext.h Removing src/include/stamp-ext-h === using patch(1) to apply patch ./0001-enable-fetching-explain-plans-from-foreign-server.patch === patch: unrecognized option `--no-backup-if-mismatch' usage: patch [-bCcEeflNnRstuv] [-B backup-prefix] [-D symbol] [-d directory] [-F max-fuzz] [-i patchfile] [-o out-file] [-p strip-count] [-r rej-name] [-V t | nil | never | none] [-x number] [-z backup-ext] [--posix] [origfile [patchfile]] patch defname, "analyze") == 0) + es->analyze = defGetBoolean(opt); + else if (strcmp(opt->defname, "verbose") == 0) + es->verbose = defGetBoolean(opt); + else if (strcmp(opt->defname, "costs") == 0) + es->costs = defGetBoolean(opt); + else if (strcmp(opt->defname, "buffers") == 0) + { + buffers_set = true; + es->buffers = defGetBoolean(opt); + } + else if (strcmp(opt->defname, "wal") == 0) + es->wal = defGetBoolean(opt); + else if (strcmp(opt->defname, "settings") == 0) + es->settings = defGetBoolean(opt); + else if (strcmp(opt->defname, "generic_plan") == 0) + es->generic = defGetBoolean(opt); + else if (strcmp(opt->defname, "timing") == 0) + { + timing_set = true; + es->timing = defGetBoolean(opt); + } + else if (strcmp(opt->defname, "summary") == 0) + { + summary_set = true; + es->summary = defGetBoolean(opt); + } + else if (strcmp(opt->defname, "memory") == 0) + es->memory = defGetBoolean(opt); + else if (strcmp(opt->defname, "serialize") == 0) + { + if (opt->arg) + { + char *p = defGetString(opt); + + if (strcmp(p, "off") == 0 || strcmp(p, "none") == 0) + es->serialize = EXPLAIN_SERIALIZE_NONE; + else if (strcmp(p, "text") == 0) + es->serialize = EXPLAIN_SERIALIZE_TEXT; + else if (strcmp(p, "binary") == 0) + es->serialize = EXPLAIN_SERIALIZE_BINARY; + else + ereport(ERROR, + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("unrecognized value for EXPLAIN option \"%s\": \"%s\"", + opt->defname, p), + parser_errposition(pstate, opt->location))); + } + else + { + /* SERIALIZE without an argument is taken as 'text' */ + es->serialize = EXPLAIN_SERIALIZE_TEXT; + } + } + else if (strcmp(opt->defname, "format") == 0) + { + char *p = defGetString(opt); + + if (strcmp(p, "text") == 0) + es->format = EXPLAIN_FORMAT_TEXT; + else if (strcmp(p, "xml") == 0) + es->format = EXPLAIN_FORMAT_XML; + else if (strcmp(p, "json") == 0) + es->format = EXPLAIN_FORMAT_JSON; + else if (strcmp(p, "yaml") == 0) + es->format = EXPLAIN_FORMAT_YAML; + else + ereport(ERROR, + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("unrecognized value for EXPLAIN option \"%s\": \"%s\"", + opt->defname, p), + parser_errposition(pstate, opt->location))); + } + else + ereport(ERROR, + (errcode(ERRCODE_SYNTAX_ERROR), + errmsg("unrecognized EXPLAIN option \"%s\"", + opt->defname), + parser_errposition(pstate, opt->location))); + } + /* if the timing was not set explicitly, set default value */ + es->timing = (timing_set) ? es->timing : es->analyze; + + /* if the summary was not set explicitly, set default value */ + es->summary = (summary_set) ? es->summary : es->analyze; + + return es; + } /* * ExplainQuery - @@@ -176,16 -296,38 +284,47 @@@ voi ExplainQuery(ParseState *pstate, ExplainStmt *stmt, ParamListInfo params, DestReceiver *dest) { - ExplainState *es = NewExplainState(); + ExplainState *es; ++>>>>>>> theirs TupOutputState *tstate; JumbleState *jstate = NULL; Query *query; List *rewritten; ++<<<<<<< ours + + /* Configure the ExplainState based on the provided options */ + ParseExplainOptionList(es, stmt->options, pstate); + + /* Extract the query and, if enabled, jumble it */ ++======= + + es = ParseExplainStmtOptions(pstate, stmt->options); + + /* check that WAL is used with EXPLAIN ANALYZE */ + if (es->wal && !es->analyze) + ereport(ERROR, + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("EXPLAIN option %s requires ANALYZE", "WAL"))); + + /* check that timing is used with EXPLAIN ANALYZE */ + if (es->timing && !es->analyze) + ereport(ERROR, + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("EXPLAIN option %s requires ANALYZE", "TIMING"))); + + /* check that serialize is used with EXPLAIN ANALYZE */ + if (es->serialize != EXPLAIN_SERIALIZE_NONE && !es->analyze) + ereport(ERROR, + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("EXPLAIN option %s requires ANALYZE", "SERIALIZE"))); + + /* check that GENERIC_PLAN is not used with EXPLAIN ANALYZE */ + if (es->generic && es->analyze) + ereport(ERROR, + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("EXPLAIN options ANALYZE and GENERIC_PLAN cannot be used together"))); + ++>>>>>>> theirs query = castNode(Query, stmt->query); if (IsQueryIdEnabled()) jstate = JumbleQuery(query);