| -- Some additional checks for RULEs |
| -- Test turning a table into a view. |
| CREATE table table_to_view_test1 (a int); |
| NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Apache Cloudberry data distribution key for this table. |
| HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew. |
| CREATE table table_to_view_test2 (a int); |
| NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Apache Cloudberry data distribution key for this table. |
| HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew. |
| CREATE rule "_RETURN" as on select to table_to_view_test1 |
| do instead select * from table_to_view_test2; |
| -- relkind has been changed to 'v' |
| SELECT relkind FROM pg_class |
| WHERE oid = 'table_to_view_test1'::regclass; |
| relkind |
| --------- |
| v |
| (1 row) |
| |
| -- distribution policy record has been deleted |
| SELECT 1 FROM gp_distribution_policy |
| WHERE localoid = 'table_to_view_test1'::regclass; |
| ?column? |
| ---------- |
| (0 rows) |
| |
| DROP VIEW table_to_view_test1; |
| DROP TABLE table_to_view_test2; |
| -- Same for an Append-Only table. It is currently not supported. |
| CREATE table aotable_to_view_test1 (a int) with (appendonly=true); |
| NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Apache Cloudberry data distribution key for this table. |
| HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew. |
| CREATE table aotable_to_view_test2 (a int); |
| NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Apache Cloudberry data distribution key for this table. |
| HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew. |
| CREATE rule "_RETURN" as on select to aotable_to_view_test1 |
| do instead select * from aotable_to_view_test2; |
| ERROR: cannot convert non-heap table "aotable_to_view_test1" to a view |
| drop table aotable_to_view_test1; |
| drop table aotable_to_view_test2; |