By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
Help with an interesting Postgres question: Why isn't an Index Only Scan used on a partition accessed via the parent table?.
CREATE TABLE namespace_list (id int, namespace_ids json DEFAULT '[]'::json);
INSERT INTO namespace_list VALUES
(1, '[1,2,3]')
, (2, '[5,9,3]');
2 rows affected
TABLE namespace_list;
id | namespace_ids |
---|---|
1 | [1,2,3] |
2 | [5,9,3] |
ALTER TABLE namespace_list
ALTER COLUMN namespace_ids DROP DEFAULT
, ALTER COLUMN namespace_ids TYPE INT[] USING translate(namespace_ids::text, '[]','{}')::int[]
, ALTER COLUMN namespace_ids SET DEFAULT '{}';
TABLE namespace_list;
id | namespace_ids |
---|---|
1 | {1,2,3} |
2 | {5,9,3} |