Re: [PATCH] no table rewrite when set column type to constrained domain - Mailing list pgsql-hackers

From jian he
Subject Re: [PATCH] no table rewrite when set column type to constrained domain
Date
Msg-id CACJufxHR1XavFx2NTOkwKXm+Cyn2h5=u6Pz+AQgp52ixqOiGHw@mail.gmail.com
Whole thread
In response to Re: [PATCH] no table rewrite when set column type to constrained domain  (Aditya Gollamudi <adigollamudi@gmail.com>)
Responses Re: [PATCH] no table rewrite when set column type to constrained domain
List pgsql-hackers
hi.

https://postgr.es/m/CAEze2Wi4M1grsR0q27etuB-jncJ6qN-1FMdRX-2PkQxcFpM3sQ@mail.gmail.com
Make me realize that ArrayCoerceExpr (one type of array cast to
another type of array) table rewrite is necessary.
For example, the following will cause a table rewrite:
+CREATE TABLE t22(a INT, b INT, c text COLLATE "C", col1 INT[]);
+CREATE DOMAIN domain1 AS INT CHECK(VALUE > 1) NOT NULL;
+CREATE DOMAIN domain2 AS domain1 CHECK(VALUE > 1) NOT NULL;
+CREATE DOMAIN domain6 AS domain2[];
+ALTER TABLE t22 ALTER COLUMN col1 SET DATA TYPE domain6 USING col1;

Now: if the new type is a constrained domain over the old type,
tablescan is enough.
ATColumnChangeRequiresRewrite works just as before.



--
jian
https://www.enterprisedb.com/

Attachment

pgsql-hackers by date:

Previous
From: Bharath Rupireddy
Date:
Subject: Re: Reduce log level of some logical decoding messages to DEBUG1
Next
From: Tom Lane
Date:
Subject: Re: Trying out