From e2395cdbe83adc50ac03dd17474ee88c5a97359a Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Thu, 28 Mar 2024 16:51:20 +0100 Subject: ALTER TABLE: rework determination of access method ID Avoid setting an access method OID for relation kinds that don't take one. Code review for new feature added in 374c7a229042. Author: Justin Pryzby Reported-by: Alexander Lakhin Discussion: https://postgr.es/m/e5516ac1-5264-c3c0-d822-9e6f614ea93b@gmail.com --- src/test/regress/expected/create_am.out | 3 +++ src/test/regress/sql/create_am.sql | 3 +++ 2 files changed, 6 insertions(+) (limited to 'src/test') diff --git a/src/test/regress/expected/create_am.out b/src/test/regress/expected/create_am.out index a27805a8f5e..aa4cb4fa77f 100644 --- a/src/test/regress/expected/create_am.out +++ b/src/test/regress/expected/create_am.out @@ -547,6 +547,9 @@ CREATE TABLE i_am_a_failure() USING "I do not exist AM"; ERROR: access method "I do not exist AM" does not exist CREATE TABLE i_am_a_failure() USING "btree"; ERROR: access method "btree" is not of type TABLE +-- Other weird invalid cases that cause problems +CREATE FOREIGN TABLE fp PARTITION OF pg_am DEFAULT SERVER x; +ERROR: "pg_am" is not partitioned -- Drop table access method, which fails as objects depends on it DROP ACCESS METHOD heap2; ERROR: cannot drop access method heap2 because other objects depend on it diff --git a/src/test/regress/sql/create_am.sql b/src/test/regress/sql/create_am.sql index adff0079f98..c57a87da4b9 100644 --- a/src/test/regress/sql/create_am.sql +++ b/src/test/regress/sql/create_am.sql @@ -348,6 +348,9 @@ CREATE TABLE i_am_a_failure() USING i_do_not_exist_am; CREATE TABLE i_am_a_failure() USING "I do not exist AM"; CREATE TABLE i_am_a_failure() USING "btree"; +-- Other weird invalid cases that cause problems +CREATE FOREIGN TABLE fp PARTITION OF pg_am DEFAULT SERVER x; + -- Drop table access method, which fails as objects depends on it DROP ACCESS METHOD heap2; -- cgit v1.2.3