Skip to content

create_range_partitions() fail #17

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

Closed
Alexey1981 opened this issue Jun 29, 2016 · 2 comments
Closed

create_range_partitions() fail #17

Alexey1981 opened this issue Jun 29, 2016 · 2 comments
Assignees
Labels

Comments

@Alexey1981
Copy link

Postgresql version: 9.5

Table definitions (1K rows):

comment=# \d+ comment;
                                                               Table "public.comment"
     Column     |            Type             |                          Modifiers                           | Storage  | Stats target | Description
----------------+-----------------------------+--------------------------------------------------------------+----------+--------------+-------------
 comment_id     | integer                     | not null default nextval('comment_comment_id_seq'::regclass) | plain    |              |
 created_at     | timestamp without time zone | not null                                                     | plain    |              |
 updated_at     | timestamp without time zone | not null                                                     | plain    |              |
 entity_type_id | smallint                    | not null                                                     | plain    |              |
 entity_id      | integer                     | not null                                                     | plain    |              |
 status_id      | smallint                    | not null                                                     | plain    |              |
 comment_index  | integer                     | not null                                                     | plain    |              |
 anonymously    | boolean                     | not null                                                     | plain    |              |
 user_id        | integer                     | not null                                                     | plain    |              |
 user_name      | character varying(256)      | not null                                                     | extended |              |
 user_mail      | character varying(256)      | not null                                                     | extended |              |
 user_cookie    | character varying(32)       | not null                                                     | extended |              |
 user_ip        | inet                        | not null                                                     | main     |              |
 user_agent_id  | integer                     | not null                                                     | plain    |              |
 moderator_id   | integer                     | not null                                                     | plain    |              |
 extra          | jsonb                       | not null                                                     | extended |              |
 body           | text                        | not null                                                     | extended |              |
Indexes:
    "comment_pkey" PRIMARY KEY, btree (comment_id)
    "comment_entity_id_entity_type_id_comment_index_idx" btree (entity_id, entity_type_id, comment_index)
Check constraints:
    "comment_comment_id_check" CHECK (0 < comment_id)
    "comment_comment_index_check" CHECK (0 <= comment_index)
    "comment_entity_id_check" CHECK (0 < entity_id)
    "comment_entity_type_id_check" CHECK (0 < entity_type_id)
    "comment_moderator_id_check" CHECK (0 <= moderator_id)
    "comment_status_id_check" CHECK (0 < status_id)
    "comment_user_agent_id_check" CHECK (0 <= user_agent_id)
    "comment_user_id_check" CHECK (0 <= user_id)

Result:

comment=# select create_range_partitions('comment', 'entity_id', 1, 10000);
NOTICE:  sequence "comment_seq" does not exist, skipping
CONTEXT:  SQL statement "DROP SEQUENCE IF EXISTS public.comment_seq"
PL/pgSQL function create_or_replace_sequence(text,text) line 5 at EXECUTE
SQL statement "SELECT public.create_or_replace_sequence(v_plain_schema, v_plain_relname)"
PL/pgSQL function create_range_partitions(regclass,text,anyelement,anyelement,integer) line 49 at PERFORM
WARNING:  Wrong CHECK constraint for relation 'comment_2'. It MUST have exact format: VARIABLE >= CONST AND VARIABLE < CONST. Skipping...
CONTEXT:  SQL statement "SELECT public.on_create_partitions(p_relation::regclass::oid)"
PL/pgSQL function create_range_partitions(regclass,text,anyelement,anyelement,integer) line 68 at PERFORM
WARNING:  Wrong CHECK constraint for relation 'comment_2'. It MUST have exact format: VARIABLE >= CONST AND VARIABLE < CONST. Skipping...
CONTEXT:  SQL statement "SELECT public.on_create_partitions(p_relation::regclass::oid)"
PL/pgSQL function create_range_partitions(regclass,text,anyelement,anyelement,integer) line 68 at PERFORM
WARNING:  Wrong CHECK constraint for relation 'comment_2'. It MUST have exact format: VARIABLE >= CONST AND VARIABLE < CONST. Skipping...
CONTEXT:  SQL statement "SELECT public.on_create_partitions(p_relation::regclass::oid)"
PL/pgSQL function create_range_partitions(regclass,text,anyelement,anyelement,integer) line 68 at PERFORM
WARNING:  Wrong CHECK constraint for relation 'comment_2'. It MUST have exact format: VARIABLE >= CONST AND VARIABLE < CONST. Skipping...
CONTEXT:  SQL statement "SELECT public.on_create_partitions(p_relation::regclass::oid)"
PL/pgSQL function create_range_partitions(regclass,text,anyelement,anyelement,integer) line 68 at PERFORM
WARNING:  Wrong CHECK constraint for relation 'comment_2'. It MUST have exact format: VARIABLE >= CONST AND VARIABLE < CONST. Skipping...
CONTEXT:  SQL statement "SELECT public.on_create_partitions(p_relation::regclass::oid)"
PL/pgSQL function create_range_partitions(regclass,text,anyelement,anyelement,integer) line 68 at PERFORM
WARNING:  Wrong CHECK constraint for relation 'comment_2'. It MUST have exact format: VARIABLE >= CONST AND VARIABLE < CONST. Skipping...
CONTEXT:  SQL statement "SELECT public.on_create_partitions(p_relation::regclass::oid)"
PL/pgSQL function create_range_partitions(regclass,text,anyelement,anyelement,integer) line 68 at PERFORM
WARNING:  Wrong CHECK constraint for relation 'comment_2'. It MUST have exact format: VARIABLE >= CONST AND VARIABLE < CONST. Skipping...
CONTEXT:  SQL statement "SELECT public.on_create_partitions(p_relation::regclass::oid)"
PL/pgSQL function create_range_partitions(regclass,text,anyelement,anyelement,integer) line 68 at PERFORM
WARNING:  Wrong CHECK constraint for relation 'comment_2'. It MUST have exact format: VARIABLE >= CONST AND VARIABLE < CONST. Skipping...
CONTEXT:  SQL statement "SELECT public.on_create_partitions(p_relation::regclass::oid)"
PL/pgSQL function create_range_partitions(regclass,text,anyelement,anyelement,integer) line 68 at PERFORM
WARNING:  Wrong CHECK constraint for relation 'comment_3'. It MUST have exact format: VARIABLE >= CONST AND VARIABLE < CONST. Skipping...
CONTEXT:  SQL statement "SELECT public.on_create_partitions(p_relation::regclass::oid)"
PL/pgSQL function create_range_partitions(regclass,text,anyelement,anyelement,integer) line 68 at PERFORM
WARNING:  Wrong CHECK constraint for relation 'comment_1'. It MUST have exact format: VARIABLE >= CONST AND VARIABLE < CONST. Skipping...
CONTEXT:  SQL statement "SELECT public.on_create_partitions(p_relation::regclass::oid)"
PL/pgSQL function create_range_partitions(regclass,text,anyelement,anyelement,integer) line 68 at PERFORM
WARNING:  Wrong CHECK constraint for relation 'comment_1'. It MUST have exact format: VARIABLE >= CONST AND VARIABLE < CONST. Skipping...
CONTEXT:  SQL statement "SELECT public.on_create_partitions(p_relation::regclass::oid)"
PL/pgSQL function create_range_partitions(regclass,text,anyelement,anyelement,integer) line 68 at PERFORM
WARNING:  Wrong CHECK constraint for relation 'comment_1'. It MUST have exact format: VARIABLE >= CONST AND VARIABLE < CONST. Skipping...
CONTEXT:  SQL statement "SELECT public.on_create_partitions(p_relation::regclass::oid)"
PL/pgSQL function create_range_partitions(regclass,text,anyelement,anyelement,integer) line 68 at PERFORM
WARNING:  Wrong CHECK constraint for relation 'comment_1'. It MUST have exact format: VARIABLE >= CONST AND VARIABLE < CONST. Skipping...
CONTEXT:  SQL statement "SELECT public.on_create_partitions(p_relation::regclass::oid)"
PL/pgSQL function create_range_partitions(regclass,text,anyelement,anyelement,integer) line 68 at PERFORM
WARNING:  Wrong CHECK constraint for relation 'comment_1'. It MUST have exact format: VARIABLE >= CONST AND VARIABLE < CONST. Skipping...
CONTEXT:  SQL statement "SELECT public.on_create_partitions(p_relation::regclass::oid)"
PL/pgSQL function create_range_partitions(regclass,text,anyelement,anyelement,integer) line 68 at PERFORM
WARNING:  Wrong CHECK constraint for relation 'comment_1'. It MUST have exact format: VARIABLE >= CONST AND VARIABLE < CONST. Skipping...
CONTEXT:  SQL statement "SELECT public.on_create_partitions(p_relation::regclass::oid)"
PL/pgSQL function create_range_partitions(regclass,text,anyelement,anyelement,integer) line 68 at PERFORM
WARNING:  Wrong CHECK constraint for relation 'comment_1'. It MUST have exact format: VARIABLE >= CONST AND VARIABLE < CONST. Skipping...
CONTEXT:  SQL statement "SELECT public.on_create_partitions(p_relation::regclass::oid)"
PL/pgSQL function create_range_partitions(regclass,text,anyelement,anyelement,integer) line 68 at PERFORM
WARNING:  Wrong CHECK constraint for relation 'comment_1'. It MUST have exact format: VARIABLE >= CONST AND VARIABLE < CONST. Skipping...
CONTEXT:  SQL statement "SELECT public.on_create_partitions(p_relation::regclass::oid)"
PL/pgSQL function create_range_partitions(regclass,text,anyelement,anyelement,integer) line 68 at PERFORM
WARNING:  Wrong CHECK constraint for relation 'comment_3'. It MUST have exact format: VARIABLE >= CONST AND VARIABLE < CONST. Skipping...
CONTEXT:  SQL statement "SELECT public.on_create_partitions(p_relation::regclass::oid)"
PL/pgSQL function create_range_partitions(regclass,text,anyelement,anyelement,integer) line 68 at PERFORM
WARNING:  Wrong CHECK constraint for relation 'comment_3'. It MUST have exact format: VARIABLE >= CONST AND VARIABLE < CONST. Skipping...
CONTEXT:  SQL statement "SELECT public.on_create_partitions(p_relation::regclass::oid)"
PL/pgSQL function create_range_partitions(regclass,text,anyelement,anyelement,integer) line 68 at PERFORM
WARNING:  Wrong CHECK constraint for relation 'comment_3'. It MUST have exact format: VARIABLE >= CONST AND VARIABLE < CONST. Skipping...
CONTEXT:  SQL statement "SELECT public.on_create_partitions(p_relation::regclass::oid)"
PL/pgSQL function create_range_partitions(regclass,text,anyelement,anyelement,integer) line 68 at PERFORM
WARNING:  Wrong CHECK constraint for relation 'comment_3'. It MUST have exact format: VARIABLE >= CONST AND VARIABLE < CONST. Skipping...
CONTEXT:  SQL statement "SELECT public.on_create_partitions(p_relation::regclass::oid)"
PL/pgSQL function create_range_partitions(regclass,text,anyelement,anyelement,integer) line 68 at PERFORM
WARNING:  Wrong CHECK constraint for relation 'comment_3'. It MUST have exact format: VARIABLE >= CONST AND VARIABLE < CONST. Skipping...
CONTEXT:  SQL statement "SELECT public.on_create_partitions(p_relation::regclass::oid)"
PL/pgSQL function create_range_partitions(regclass,text,anyelement,anyelement,integer) line 68 at PERFORM
WARNING:  Wrong CHECK constraint for relation 'comment_3'. It MUST have exact format: VARIABLE >= CONST AND VARIABLE < CONST. Skipping...
CONTEXT:  SQL statement "SELECT public.on_create_partitions(p_relation::regclass::oid)"
PL/pgSQL function create_range_partitions(regclass,text,anyelement,anyelement,integer) line 68 at PERFORM
WARNING:  Wrong CHECK constraint for relation 'comment_3'. It MUST have exact format: VARIABLE >= CONST AND VARIABLE < CONST. Skipping...
CONTEXT:  SQL statement "SELECT public.on_create_partitions(p_relation::regclass::oid)"
PL/pgSQL function create_range_partitions(regclass,text,anyelement,anyelement,integer) line 68 at PERFORM
WARNING:  Wrong CHECK constraint for relation 'comment_4'. It MUST have exact format: VARIABLE >= CONST AND VARIABLE < CONST. Skipping...
CONTEXT:  SQL statement "SELECT public.on_create_partitions(p_relation::regclass::oid)"
PL/pgSQL function create_range_partitions(regclass,text,anyelement,anyelement,integer) line 68 at PERFORM
WARNING:  Wrong CHECK constraint for relation 'comment_4'. It MUST have exact format: VARIABLE >= CONST AND VARIABLE < CONST. Skipping...
CONTEXT:  SQL statement "SELECT public.on_create_partitions(p_relation::regclass::oid)"
PL/pgSQL function create_range_partitions(regclass,text,anyelement,anyelement,integer) line 68 at PERFORM
WARNING:  Wrong CHECK constraint for relation 'comment_4'. It MUST have exact format: VARIABLE >= CONST AND VARIABLE < CONST. Skipping...
CONTEXT:  SQL statement "SELECT public.on_create_partitions(p_relation::regclass::oid)"
PL/pgSQL function create_range_partitions(regclass,text,anyelement,anyelement,integer) line 68 at PERFORM
WARNING:  Wrong CHECK constraint for relation 'comment_4'. It MUST have exact format: VARIABLE >= CONST AND VARIABLE < CONST. Skipping...
CONTEXT:  SQL statement "SELECT public.on_create_partitions(p_relation::regclass::oid)"
PL/pgSQL function create_range_partitions(regclass,text,anyelement,anyelement,integer) line 68 at PERFORM
WARNING:  Wrong CHECK constraint for relation 'comment_4'. It MUST have exact format: VARIABLE >= CONST AND VARIABLE < CONST. Skipping...
CONTEXT:  SQL statement "SELECT public.on_create_partitions(p_relation::regclass::oid)"
PL/pgSQL function create_range_partitions(regclass,text,anyelement,anyelement,integer) line 68 at PERFORM
WARNING:  Wrong CHECK constraint for relation 'comment_4'. It MUST have exact format: VARIABLE >= CONST AND VARIABLE < CONST. Skipping...
CONTEXT:  SQL statement "SELECT public.on_create_partitions(p_relation::regclass::oid)"
PL/pgSQL function create_range_partitions(regclass,text,anyelement,anyelement,integer) line 68 at PERFORM
WARNING:  Wrong CHECK constraint for relation 'comment_4'. It MUST have exact format: VARIABLE >= CONST AND VARIABLE < CONST. Skipping...
CONTEXT:  SQL statement "SELECT public.on_create_partitions(p_relation::regclass::oid)"
PL/pgSQL function create_range_partitions(regclass,text,anyelement,anyelement,integer) line 68 at PERFORM
WARNING:  Wrong CHECK constraint for relation 'comment_4'. It MUST have exact format: VARIABLE >= CONST AND VARIABLE < CONST. Skipping...
CONTEXT:  SQL statement "SELECT public.on_create_partitions(p_relation::regclass::oid)"
PL/pgSQL function create_range_partitions(regclass,text,anyelement,anyelement,integer) line 68 at PERFORM
WARNING:  Wrong CHECK constraint for relation 'comment_5'. It MUST have exact format: VARIABLE >= CONST AND VARIABLE < CONST. Skipping...
CONTEXT:  SQL statement "SELECT public.on_create_partitions(p_relation::regclass::oid)"
PL/pgSQL function create_range_partitions(regclass,text,anyelement,anyelement,integer) line 68 at PERFORM
WARNING:  Wrong CHECK constraint for relation 'comment_5'. It MUST have exact format: VARIABLE >= CONST AND VARIABLE < CONST. Skipping...
CONTEXT:  SQL statement "SELECT public.on_create_partitions(p_relation::regclass::oid)"
PL/pgSQL function create_range_partitions(regclass,text,anyelement,anyelement,integer) line 68 at PERFORM
WARNING:  Wrong CHECK constraint for relation 'comment_5'. It MUST have exact format: VARIABLE >= CONST AND VARIABLE < CONST. Skipping...
CONTEXT:  SQL statement "SELECT public.on_create_partitions(p_relation::regclass::oid)"
PL/pgSQL function create_range_partitions(regclass,text,anyelement,anyelement,integer) line 68 at PERFORM
WARNING:  Wrong CHECK constraint for relation 'comment_5'. It MUST have exact format: VARIABLE >= CONST AND VARIABLE < CONST. Skipping...
CONTEXT:  SQL statement "SELECT public.on_create_partitions(p_relation::regclass::oid)"
PL/pgSQL function create_range_partitions(regclass,text,anyelement,anyelement,integer) line 68 at PERFORM
WARNING:  Wrong CHECK constraint for relation 'comment_5'. It MUST have exact format: VARIABLE >= CONST AND VARIABLE < CONST. Skipping...
CONTEXT:  SQL statement "SELECT public.on_create_partitions(p_relation::regclass::oid)"
PL/pgSQL function create_range_partitions(regclass,text,anyelement,anyelement,integer) line 68 at PERFORM
WARNING:  Wrong CHECK constraint for relation 'comment_5'. It MUST have exact format: VARIABLE >= CONST AND VARIABLE < CONST. Skipping...
CONTEXT:  SQL statement "SELECT public.on_create_partitions(p_relation::regclass::oid)"
PL/pgSQL function create_range_partitions(regclass,text,anyelement,anyelement,integer) line 68 at PERFORM
WARNING:  Wrong CHECK constraint for relation 'comment_5'. It MUST have exact format: VARIABLE >= CONST AND VARIABLE < CONST. Skipping...
CONTEXT:  SQL statement "SELECT public.on_create_partitions(p_relation::regclass::oid)"
PL/pgSQL function create_range_partitions(regclass,text,anyelement,anyelement,integer) line 68 at PERFORM
WARNING:  Wrong CHECK constraint for relation 'comment_5'. It MUST have exact format: VARIABLE >= CONST AND VARIABLE < CONST. Skipping...
CONTEXT:  SQL statement "SELECT public.on_create_partitions(p_relation::regclass::oid)"
PL/pgSQL function create_range_partitions(regclass,text,anyelement,anyelement,integer) line 68 at PERFORM
WARNING:  Partitions 0 and 0 overlap. Disabling pathman for relation 22848...
CONTEXT:  SQL statement "SELECT public.on_create_partitions(p_relation::regclass::oid)"
PL/pgSQL function create_range_partitions(regclass,text,anyelement,anyelement,integer) line 68 at PERFORM
WARNING:  Partitions 0 and 0 overlap. Disabling pathman for relation 22848...
CONTEXT:  SQL statement "SELECT public.on_create_partitions(p_relation::regclass::oid)"
PL/pgSQL function create_range_partitions(regclass,text,anyelement,anyelement,integer) line 68 at PERFORM
WARNING:  Partitions 0 and 0 overlap. Disabling pathman for relation 22848...
CONTEXT:  SQL statement "SELECT public.on_create_partitions(p_relation::regclass::oid)"
PL/pgSQL function create_range_partitions(regclass,text,anyelement,anyelement,integer) line 68 at PERFORM
WARNING:  Partitions 0 and 0 overlap. Disabling pathman for relation 22848...
CONTEXT:  SQL statement "SELECT public.on_create_partitions(p_relation::regclass::oid)"
PL/pgSQL function create_range_partitions(regclass,text,anyelement,anyelement,integer) line 68 at PERFORM
WARNING:  Partitions 0 and 0 overlap. Disabling pathman for relation 22848...
CONTEXT:  SQL statement "SELECT public.on_create_partitions(p_relation::regclass::oid)"
PL/pgSQL function create_range_partitions(regclass,text,anyelement,anyelement,integer) line 68 at PERFORM
WARNING:  Partitions 0 and 0 overlap. Disabling pathman for relation 22848...
CONTEXT:  SQL statement "SELECT public.on_create_partitions(p_relation::regclass::oid)"
PL/pgSQL function create_range_partitions(regclass,text,anyelement,anyelement,integer) line 68 at PERFORM
WARNING:  Partitions 0 and 0 overlap. Disabling pathman for relation 22848...
CONTEXT:  SQL statement "SELECT public.on_create_partitions(p_relation::regclass::oid)"
PL/pgSQL function create_range_partitions(regclass,text,anyelement,anyelement,integer) line 68 at PERFORM
WARNING:  Partitions 0 and 0 overlap. Disabling pathman for relation 22848...
CONTEXT:  SQL statement "SELECT public.on_create_partitions(p_relation::regclass::oid)"
PL/pgSQL function create_range_partitions(regclass,text,anyelement,anyelement,integer) line 68 at PERFORM
NOTICE:  Copying data to partitions...
CONTEXT:  SQL statement "SELECT public.partition_data(p_relation)"
PL/pgSQL function create_range_partitions(regclass,text,anyelement,anyelement,integer) line 71 at PERFORM
ERROR:  ERROR: Cannot find partition P0001
@zilder zilder added the bug label Jun 29, 2016
@zilder zilder self-assigned this Jun 29, 2016
@zilder
Copy link
Collaborator

zilder commented Jun 29, 2016

Hi @Alexey1981,
Thanks for your report! It happened because of check constraint validation mechanism. At the moment it doesn't expect multiple check constraints on the table. We'll fix this issue shortly.

@zilder
Copy link
Collaborator

zilder commented Jun 30, 2016

Hi @Alexey1981,
I've updated the code. Could you please get the latest version, rebuild it and try again?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants