citusdata / citusdata/citus

Cascading drop of schemas dot not cascade to shards for types

Open
#2,902 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
12.8k
Forks
794
Avg merge
2d 14h
Merged PRs (30d)
31

Description

Steps to reproduce:

```SQL

CREATE SCHEMA s1;
CREATE TYPE s1.type_1 AS (a int, b int);

CREATE TABLE test_table(a int, b s1.type_1);
SELECT create_distributed_table('test_table', 'a');
\d test_table
Table "public.test_table"
┌────────┬───────────┬───────────┬──────────┬─────────┐
│ Column │ Type │ Collation │ Nullable │ Default │
├────────┼───────────┼───────────┼──────────┼─────────┤
│ a │ integer │ │ │ │
│ b │ s1.type_1 │ │ │ │
└────────┴───────────┴───────────┴──────────┴─────────┘

DROP SCHEMA s1 CASCADE;

\d test_table
Table "public.test_table"
┌────────┬─────────┬───────────┬──────────┬─────────┐
│ Column │ Type │ Collation │ Nullable │ Default │
├────────┼─────────┼───────────┼──────────┼─────────┤
│ a │ integer │ │ │ │
└────────┴─────────┴───────────┴──────────┴─────────┘

-- connect to the worker node

\d test_table_102089
Table "public.test_table_102089"
┌────────┬───────────┬───────────┬──────────┬─────────┐
│ Column │ Type │ Collation │ Nullable │ Default │
├────────┼───────────┼───────────┼──────────┼─────────┤
│ a │ integer │ │ │ │
│ b │ s1.type_1 │ │ │ │
└────────┴───────────┴───────────┴──────────┴─────────┘

```

Note that with #2893, we don't have this problem with `DROP TYPE CASCADE` because we're actually cascading the command to the workers.

We should perhaps propagate the `DROP SCHEMA CASCADE` as well.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the SQL sequence in the issue and compare the worker shard after DROP SCHEMA CASCADE. Read the related DROP TYPE CASCADE work in #2893, then verify that cascading the schema removal leaves the worker shard without the dropped composite-type column.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, postgresql, sql
Domain
databases, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.