alter_distributed_table() DROPs functions depends on the table
- Dominant language
- C
- Stars
- 12.8k
- Forks
- 794
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 31
Description
```SQL
CREATE TABLE test(id int);
SELECT create_distributed_table('test', 'id');
CREATE OR REPLACE FUNCTION func_in_transaction_3(param_1 test)
RETURNS int
LANGUAGE plpgsql AS
$$
BEGIN
return 1;
END;
$$;
\df func_in_transaction_3
List of functions
┌────────┬───────────────────────┬──────────────────┬─────────────────────┬──────┐
│ Schema │ Name │ Result data type │ Argument data types │ Type │
├────────┼───────────────────────┼──────────────────┼─────────────────────┼──────┤
│ public │ func_in_transaction_3 │ integer │ param_1 test │ func │
└────────┴───────────────────────┴──────────────────┴─────────────────────┴──────┘
(1 row)
select alter_distributed_table('test', shard_count:=4);
-- ops, function dropped
\df func_in_transaction_3
List of functions
┌────────┬──────┬──────────────────┬─────────────────────┬──────┐
│ Schema │ Name │ Result data type │ Argument data types │ Type │
├────────┼──────┼──────────────────┼─────────────────────┼──────┤
└────────┴──────┴──────────────────┴─────────────────────┴──────┘
(0 rows)
```
Similarly for `undistribute_table`:
```SQL
CREATE OR REPLACE FUNCTION func_in_transaction_3(param_1 test)
RETURNS int
LANGUAGE plpgsql AS
$$
BEGIN
return 1;
END;
$$;
select undistribute_table('test');
NOTICE: creating a new table for public.test
NOTICE: moving the data of public.test
NOTICE: dropping the old public.test
NOTICE: drop cascades to function func_in_transaction_3(test)
-- ops, function dropped
\df func_in_transaction_3
List of functions
┌────────┬──────┬──────────────────┬─────────────────────┬──────┐
│ Schema │ Name │ Result data type │ Argument data types │ Type │
├────────┼──────┼──────────────────┼─────────────────────┼──────┤
└────────┴──────┴──────────────────┴─────────────────────┴──────┘
(0 rows)
```
Contributor guide
Assessment
This issue has not been assessed yet.