pgmerge pg15

naisila/pg17_fix_merge_diffs
naisila 2024-11-19 17:05:18 +03:00
parent ffac58805b
commit 3174f6c903
4 changed files with 17 additions and 8 deletions

View File

@ -309,3 +309,12 @@ s/permission denied to terminate process/must be a superuser to terminate superu
s/permission denied to cancel query/must be a superuser to cancel superuser query/g
#endif /* PG_VERSION_NUM < PG_VERSION_16 */
# pg17 changes
# can be removed when dropping PG14&15&16 support
#if PG_VERSION_NUM < PG_VERSION_17
# (This is not preprocessor directive, but a reminder for the developer that will drop PG14&15&16 support )
s/(WITH|COPY) (.*) a RETURNING clause/MERGE not supported in \1 query without a RETURNING clause/g
#endif /* PG_VERSION_NUM < PG_VERSION_17 */

View File

@ -441,12 +441,12 @@ WITH foo AS (
MERGE INTO tbl1 USING tbl2 ON (true)
WHEN MATCHED THEN DELETE
) SELECT * FROM foo;
ERROR: MERGE not supported in WITH query
ERROR: MERGE not supported in WITH query without a RETURNING clause
COPY (
MERGE INTO tbl1 USING tbl2 ON (true)
WHEN MATCHED THEN DELETE
) TO stdout;
ERROR: MERGE not supported in COPY
ERROR: MERGE not supported in COPY query without a RETURNING clause
MERGE INTO tbl1 t
USING tbl2
ON (true)

View File

@ -162,18 +162,18 @@ ON tid = tid
WHEN MATCHED THEN DO NOTHING;
ERROR: name "target" specified more than once
DETAIL: The name is used both as MERGE target table and data source.
-- used in a CTE
-- used in a CTE without RETURNING
WITH foo AS (
MERGE INTO target USING source ON (true)
WHEN MATCHED THEN DELETE
) SELECT * FROM foo;
ERROR: MERGE not supported in WITH query
-- used in COPY
ERROR: MERGE not supported in WITH query without a RETURNING clause
-- used in COPY without RETURNING
COPY (
MERGE INTO target USING source ON (true)
WHEN MATCHED THEN DELETE
) TO stdout;
ERROR: MERGE not supported in COPY
ERROR: MERGE not supported in COPY query without a RETURNING clause
-- unsupported relation types
-- view
CREATE VIEW tv AS SELECT * FROM target;

View File

@ -116,12 +116,12 @@ MERGE INTO target
USING target
ON tid = tid
WHEN MATCHED THEN DO NOTHING;
-- used in a CTE
-- used in a CTE without RETURNING
WITH foo AS (
MERGE INTO target USING source ON (true)
WHEN MATCHED THEN DELETE
) SELECT * FROM foo;
-- used in COPY
-- used in COPY without RETURNING
COPY (
MERGE INTO target USING source ON (true)
WHEN MATCHED THEN DELETE