Op 28-01-2022 om 21:27 schreef Alvaro Herrera:
MERGE, v10. I am much more comfortable with this version; I have removed a bunch of temporary hacks and cleaned up the interactions with table AM and executor, which is something that had been bothering me for a while. The complete set of changes can be seen in github, https://github.com/alvherre/postgres/commits/merge-15
[v10-0001-MERGE-SQL-Command-following-SQL-2016.patch]
The patch doesnt apply smoothly: patching file src/backend/tcop/pquery.c patching file src/backend/tcop/utility.c patching file src/backend/utils/adt/ruleutils.c patching file src/bin/psql/tab-complete.c Hunk #3 FAILED at 1714. Hunk #4 succeeded at 3489 (offset 6 lines). Hunk #5 succeeded at 3508 (offset 6 lines). Hunk #6 succeeded at 3776 (offset 6 lines). Hunk #7 succeeded at 3855 (offset 6 lines).1 out of 7 hunks FAILED -- saving rejects to file src/bin/psql/tab-complete.c.rej
patching file src/include/commands/trigger.h patching file src/include/executor/execMerge.h patching file src/include/executor/instrument.h patching file src/include/executor/nodeModifyTable.h tab-complete.c.rej attached Erik
--- src/bin/psql/tab-complete.c +++ src/bin/psql/tab-complete.c @@ -1714,6 +1736,12 @@ psql_completion(const char *text, int start, int end) /* ALTER PUBLICATION <name> ADD */ else if (Matches("ALTER", "PUBLICATION", MatchAny, "ADD")) COMPLETE_WITH("ALL TABLES IN SCHEMA", "TABLE"); + else if (Matches("ALTER", "PUBLICATION", MatchAny, "ADD|SET", "TABLE") || + (HeadMatches("ALTER", "PUBLICATION", MatchAny, "ADD|SET", "TABLE") && + ends_with(prev_wd, ','))) + COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tables, NULL); + else if (HeadMatches("ALTER", "PUBLICATION", MatchAny, "ADD|SET", "TABLE")) + COMPLETE_WITH(","); /* ALTER PUBLICATION <name> DROP */ else if (Matches("ALTER", "PUBLICATION", MatchAny, "DROP")) COMPLETE_WITH("ALL TABLES IN SCHEMA", "TABLE");