citusdata / citusdata/citus

alter_distributed_table() DROPs functions depends on the table

Open
#5,903 1 comment 0 reactions 0 assignees View on GitHub
bug
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.