You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The output of show_partitions return "Given parent table not managed by pg_partman" ..
Some databases have schema created by using a schema dump from another database. Schema dump shows partition table creation as explicit create table statements not using the create_parent.
These partitions are not returned by the show_partitions, as the part_config is empty. Is there any way to fix this?
CREATE TABLE public.test_table (
id bigint NOT NULL,
name text,
createdat timestamp with time zone NOT NULL
)
PARTITION BY RANGE (createdat);
-- it seems template table is never used
CREATE TABLE partman.template_public_test_table (
id bigint NOT NULL,
name text,
createdat timestamp with time zone NOT NULL
);
CREATE TABLE public.test_table_default (
id bigint NOT NULL,
name text,
createdat timestamp with time zone NOT NULL
);
CREATE TABLE public.test_table_p2023_01 (
id bigint NOT NULL,
name text,
createdat timestamp with time zone NOT NULL
);
ALTER TABLE ONLY public.test_table ATTACH PARTITION public.test_table_default DEFAULT;
ALTER TABLE ONLY public.test_table ATTACH PARTITION public.test_table_p2023_01 FOR VALUES FROM ('2023-01-01 00:00:00+00') TO ('2023-02-01 00:00:00+00');
Partitions: test_table_p2023_01 FOR VALUES FROM ('2023-01-01 00:00:00+00') TO ('2023-02-01 00:00:00+00'),
test_table_p2023_02 FOR VALUES FROM ('2023-02-01 00:00:00+00') TO ('2023-03-01 00:00:00+00'),
test_table_p2023_03 FOR VALUES FROM ('2023-03-01 00:00:00+00') TO ('2023-04-01 00:00:00+00'),
test_table_default DEFAULT
Update: I had to drop test_table_default (it has no data) and then create_parent seemed to work as there were no failures.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
The output of show_partitions return "Given parent table not managed by pg_partman" ..
Some databases have schema created by using a schema dump from another database. Schema dump shows partition table creation as explicit create table statements not using the create_parent.
These partitions are not returned by the show_partitions, as the part_config is empty. Is there any way to fix this?
I read this document https://github.com/pgpartman/pg_partman/blob/5.0.0-beta/doc/migrate_to_partman.md
I am using pg_partman less than 5.0.0
As the names are aligned with partman. simply doing create_parent should work?
Update: I had to drop test_table_default (it has no data) and then create_parent seemed to work as there were no failures.
Beta Was this translation helpful? Give feedback.
All reactions