Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First range is repeating for the generated partition. #3

Open
jobinau opened this issue Jan 24, 2023 · 1 comment
Open

First range is repeating for the generated partition. #3

jobinau opened this issue Jan 24, 2023 · 1 comment

Comments

@jobinau
Copy link
Owner

jobinau commented Jan 24, 2023

Thanks to @gianmh for reporting the problem.

Problem Reproduction step

Create the first partition

CREATE TABLE public.tab1_p0 PARTITION OF public.tab1 FOR VALUES FROM ('0') TO ('500000');

Then generate the new partitions.

./pg_partmaint.py -c "" -t public.tab1 -i 5000000 -p 40 --display

The output generated for newly created partition will contain the same partition again

 CREATE TABLE public.tab1_p0 PARTITION OF public.tab1 FOR VALUES FROM ('0') TO ('5000000')
 CREATE TABLE public.tab1_p5000000 PARTITION OF public.tab1 FOR VALUES FROM ('5000000') TO ('10000000')
 CREATE TABLE public.tab1_p10000000 PARTITION OF public.tab1 FOR VALUES FROM ('10000000') TO ('15000000')
 CREATE TABLE public.tab1_p15000000 PARTITION OF public.tab1 FOR VALUES FROM ('15000000') TO ('20000000')
@jobinau
Copy link
Owner Author

jobinau commented Jan 24, 2023

Analysis reveals that the cause of the problem is that the DDL returned by pg_catalog.pg_get_expr() will be unquoted values like

FOR VALUES FROM (0) TO (500000)

Instead of what was expected by the existing logic, like

FOR VALUES FROM ('0') TO ('500000')

jobinau added a commit that referenced this issue Jan 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant