Re: ERROR: "ft1" is of the wrong type.

Kyotaro Horiguchi <horikyota.ntt@gmail.com>

From: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
To: michael@paquier.xyz
Cc: pgsql-hackers@lists.postgresql.org
Date: 2021-02-19T08:30:39Z
Lists: pgsql-hackers

Attachments

At Thu, 18 Feb 2021 17:17:37 +0900 (JST), Kyotaro Horiguchi <horikyota.ntt@gmail.com> wrote in 
> I can add some regression tests to cover all the live cases. That
> could reveal no-longer-used combinations.

The attached is that.

ATT_VIEW is used for "CREATE OR REPLACE view" and checked against
earlier in DefineVirtualRelation. But we can add a test to make sure
that is checked anywhere.

All other values can be exercised.

ATT_TABLE | ATT_MATVIEW
ATT_TABLE | ATT_MATVIEW | ATT_INDEX | ATT_PARTITIONED_INDEX
ATT_TABLE | ATT_MATVIEW | ATT_INDEX | ATT_PARTITIONED_INDEX |
     ATT_FOREIGN_TABLE
ATT_TABLE | ATT_MATVIEW | ATT_FOREIGN_TABLE
ATT_TABLE | ATT_MATVIEW | ATT_INDEX | ATT_FOREIGN_TABLE
ATT_TABLE | ATT_PARTITIONED_INDEX
ATT_TABLE | ATT_VIEW | ATT_MATVIEW | ATT_INDEX
ATT_TABLE | ATT_VIEW | ATT_FOREIGN_TABLE:
ATT_FOREIGN_TABLE

These are provoked by the following commands respectively:

  ALTER TABLE <view> CLUSTER ON
  ALTER TABLE <view> SET TABLESPACE
  ALTER TABLE <view> ALTER COLUMN <col> SET STATISTICS
  ALTER TABLE <view> ALTER COLUMN <col> SET STORGE
  ALTER TABLE <view> ALTER COLUMN <col> SET()
  ALTER TABLE <view> ATTACH PARTITION
  ALTER TABLE/INDEX <partidx> SET/RESET
  ALTER TABLE <matview> ALTER <col> SET DEFAULT
  ALTER TABLE/INDEX <pidx> ALTER COLLATION ..REFRESH VERSION
  ALTER TABLE <view> OPTIONS ()

The following three errors are already excised.

ATT_TABLE
ATT_TABLE | ATT_FOREIGN_TABLE
ATT_TABLE | ATT_COMPOSITE_TYPE | ATT_FOREIGN_TABLE:


By the way, I find this as somewhat mystifying. I'm not sure it worth
fixing though..

ALTER MATERIALIZED VIEW mv1 ALTER COLUMN a SET DEFAULT 1;
ERROR:  "mv1" is not a table, view, or foreign table

regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center

Commits

  1. Fix unexpected error messages for various flavors of ALTER TABLE

  2. Revert per-index collation version tracking feature.

  3. Restructure ALTER TABLE execution to fix assorted bugs.