Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saicitus/e272ebcaeb504c8a657c06741e299874 to your computer and use it in GitHub Desktop.
Save saicitus/e272ebcaeb504c8a657c06741e299874 to your computer and use it in GitHub Desktop.
CREATE TABLE test (x varchar, y int);
SELECT create_distributed_table('test', 'x');
BEGIN;
SET LOCAL citus.enable_ddl_propagation TO off;
DELETE FROM pg_depend WHERE objid = 'test'::regclass AND objid = refobjid RETURNING *;
ALTER TABLE test ALTER COLUMN x TYPE text;
SELECT * FROM run_command_on_placements('test', 'ALTER TABLE %I ALTER COLUMN x TYPE text');
UPDATE pg_dist_partition SET partkey = column_name_to_column('test', 'x') WHERE logicalrelid = 'test'::regclass;
COMMIT;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment