pgsql: Fix unstable tests in partition_merge.sql and partition_split.sq

2024-07-14 Thread Fujii Masao
Fix unstable tests in partition_merge.sql and partition_split.sql. The tests added by commit c086896625 were unstable due to missing schema names when checking pg_tables and pg_indexes. Backpatch to v17. Reported by buildfarm. Branch -- REL_17_STABLE Details --- https://git.postgresql.

pgsql: Fix unstable tests in partition_merge.sql and partition_split.sq

2024-07-14 Thread Fujii Masao
Fix unstable tests in partition_merge.sql and partition_split.sql. The tests added by commit c086896625 were unstable due to missing schema names when checking pg_tables and pg_indexes. Backpatch to v17. Reported by buildfarm. Branch -- master Details --- https://git.postgresql.org/pg/

pgsql: Fix tablespace handling in MERGE/SPLIT partition commands.

2024-07-14 Thread Fujii Masao
Fix tablespace handling in MERGE/SPLIT partition commands. As commit ca4103025d stated, new partitions without a specified tablespace should inherit the parent relation's tablespace. However, previously, ALTER TABLE MERGE PARTITIONS and ALTER TABLE SPLIT PARTITION commands always created new parti

pgsql: Fix tablespace handling in MERGE/SPLIT partition commands.

2024-07-14 Thread Fujii Masao
Fix tablespace handling in MERGE/SPLIT partition commands. As commit ca4103025d stated, new partitions without a specified tablespace should inherit the parent relation's tablespace. However, previously, ALTER TABLE MERGE PARTITIONS and ALTER TABLE SPLIT PARTITION commands always created new parti

pgsql: Check lateral references within PHVs for memoize cache keys

2024-07-14 Thread Richard Guo
Check lateral references within PHVs for memoize cache keys If we intend to generate a Memoize node on top of a path, we need cache keys of some sort. Currently we search for the cache keys in the parameterized clauses of the path as well as the lateral_vars of its parent. However, it turns out

pgsql: Avoid unhelpful internal error for incorrect recursive-WITH quer

2024-07-14 Thread Tom Lane
Avoid unhelpful internal error for incorrect recursive-WITH queries. checkWellFormedRecursion would issue "missing recursive reference" if a WITH RECURSIVE query contained a single self-reference but that self-reference was inside a top-level WITH, ORDER BY, LIMIT, etc, rather than inside the seco

pgsql: Avoid unhelpful internal error for incorrect recursive-WITH quer

2024-07-14 Thread Tom Lane
Avoid unhelpful internal error for incorrect recursive-WITH queries. checkWellFormedRecursion would issue "missing recursive reference" if a WITH RECURSIVE query contained a single self-reference but that self-reference was inside a top-level WITH, ORDER BY, LIMIT, etc, rather than inside the seco

pgsql: Avoid unhelpful internal error for incorrect recursive-WITH quer

2024-07-14 Thread Tom Lane
Avoid unhelpful internal error for incorrect recursive-WITH queries. checkWellFormedRecursion would issue "missing recursive reference" if a WITH RECURSIVE query contained a single self-reference but that self-reference was inside a top-level WITH, ORDER BY, LIMIT, etc, rather than inside the seco

pgsql: Avoid unhelpful internal error for incorrect recursive-WITH quer

2024-07-14 Thread Tom Lane
Avoid unhelpful internal error for incorrect recursive-WITH queries. checkWellFormedRecursion would issue "missing recursive reference" if a WITH RECURSIVE query contained a single self-reference but that self-reference was inside a top-level WITH, ORDER BY, LIMIT, etc, rather than inside the seco

pgsql: Avoid unhelpful internal error for incorrect recursive-WITH quer

2024-07-14 Thread Tom Lane
Avoid unhelpful internal error for incorrect recursive-WITH queries. checkWellFormedRecursion would issue "missing recursive reference" if a WITH RECURSIVE query contained a single self-reference but that self-reference was inside a top-level WITH, ORDER BY, LIMIT, etc, rather than inside the seco

pgsql: Avoid unhelpful internal error for incorrect recursive-WITH quer

2024-07-14 Thread Tom Lane
Avoid unhelpful internal error for incorrect recursive-WITH queries. checkWellFormedRecursion would issue "missing recursive reference" if a WITH RECURSIVE query contained a single self-reference but that self-reference was inside a top-level WITH, ORDER BY, LIMIT, etc, rather than inside the seco

pgsql: Avoid unhelpful internal error for incorrect recursive-WITH quer

2024-07-14 Thread Tom Lane
Avoid unhelpful internal error for incorrect recursive-WITH queries. checkWellFormedRecursion would issue "missing recursive reference" if a WITH RECURSIVE query contained a single self-reference but that self-reference was inside a top-level WITH, ORDER BY, LIMIT, etc, rather than inside the seco