Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dropping a custom data type used as partition key cause problems #7886

Closed
eaydingol opened this issue Feb 5, 2025 · 1 comment
Closed

Dropping a custom data type used as partition key cause problems #7886

eaydingol opened this issue Feb 5, 2025 · 1 comment

Comments

@eaydingol
Copy link
Contributor

It is possible to drop a data type that is used as a distribution key by citus.
However, as the datatype is still stored by citus, querying the corresponding table and citus_table fails,
See the logs below.
A possible solution is to avoid dropping a data when it is used as a distribution key. An alternative would be propagating the drop operation to citus internal tables (need further analysis)

ebru=# create type my_type AS (d1 int, d2 int);
CREATE TYPE
ebru=# create table test_table(data my_type, id int);
CREATE TABLE
ebru=# select create_distributed_table('test_table', 'data');
 create_distributed_table
--------------------------

(1 row)

ebru=#
ebru=# drop type my_type ;
ERROR:  cannot drop type my_type because other objects depend on it
DETAIL:  column data of table test_table depends on type my_type
HINT:  Use DROP ... CASCADE to drop the dependent objects too.
ebru=# drop type my_type cascade;
NOTICE:  drop cascades to column data of table test_table
DROP TYPE
ebru=#
ebru=# select * from test_table ;
ERROR:  cache lookup failed for type 17275
ebru=# select * from citus_tables ;
ERROR:  cache lookup failed for type 17275
ebru=#
ebru=# select * from pg_dist_colocation;
 colocationid | shardcount | replicationfactor | distributioncolumntype | distributioncolumncollation
--------------+------------+-------------------+------------------------+-----------------------------
            1 |         32 |                 1 |                  17275 |                           0
            2 |         32 |                 1 |                     23 |                           0
(2 rows)
@onurctirtir
Copy link
Member

Same as #6392, so I'm closing this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants