Description
Hi all.
While playing with something on virtual machines I've encountered weird error from pg_pathman while trying to insert a record into partitioned table:
INSERT INTO tracker_points (evented_at, tracker_id) VALUES ('2017-01-10T00:00:00Z'::timestamp, uuid_generate_v4());
ERROR: table row type and query-specified row type do not match
DETAIL: Query provides a value for a dropped column at ordinal position 6.
Steps to reproduce:
-
Install PostgreSQL 9.5.5 from apt.postgresql.org on Ubuntu Linux 14.04
-
Install pg_pathman 1.2.1:
sudo apt-get install -y build-essential git postgresql-server-dev-9.5 libkrb5-dev libssl-dev git clone https://github.com/postgrespro/pg_pathman.git cd pg_pathman git checkout 1.2.1 make USE_PGXS=1 sudo make install USE_PGXS=1 # Added pg_pathman into preload_shared_libraries # Restart postgresql
-
Create database and set up tables
-
Set up pg_pathman
CREATE EXTENSION pg_pathman; SELECT create_range_partitions( 'tracker_points', 'evented_at', '2015-06-01'::timestamp, '1 month'::interval, 0, false ) SELECT add_range_partition( 'tracker_points', '2015-06-01'::timestamp, '2015-06-01'::timestamp + '1 month'::interval, 'tracker_points_2015_06' ) SELECT append_range_partition('tracker_points', 'tracker_points_2015_07') -- and so on SELECT append_range_partition('tracker_points', 'tracker_points_2017_01') SELECT set_enable_parent('tracker_points', false) SELECT partition_table_concurrently('tracker_points')
All commands executed successfully and in server logs appeared
2017-01-10 19:53:40 MSK [2944-1] LOG: ConcurrentPartWorker: loaded pg_pathman's config [2944]
At this point of time all tables are empty.
-
Try to insert record:
INSERT INTO tracker_points (evented_at, tracker_id) VALUES ('2017-01-10T00:00:00Z'::timestamp, uuid_generate_v4());
Which fails with next error:
ERROR: table row type and query-specified row type do not match DETAIL: Query provides a value for a dropped column at ordinal position 6.
Both parent and child tables look the same. These exact setup and this exact query is working in production on pg_pathman 1.1 and on staging environment on pg_pathman 1.2.1 upgraded from 1.1, but on virtual environment with fresh install is broken.
\d+
for parent table (tracker_points
):
Table "public.tracker_points"
Column | Type | Modifiers | Storage | Stats target | Description
---------------------+-----------------------------+-------------------------------------+----------+--------------+-------------
id | uuid | not null default uuid_generate_v4() | plain | |
tracker_id | uuid | not null | plain | |
data | jsonb | not null default '{}'::jsonb | extended | |
evented_at | timestamp without time zone | not null | plain | |
created_at | timestamp without time zone | | plain | |
ambulance_status_id | integer | | plain | |
in_zone | boolean | not null default true | plain | |
is_stop | boolean | default false | plain | |
Indexes:
"tracker_points_pkey" PRIMARY KEY, btree (id)
"index_tracker_points_on_evented_at" brin (evented_at)
"index_tracker_points_on_tracker_id" btree (tracker_id)
"main_tracker_points_search_index" btree (tracker_id, evented_at DESC)
"tracker_points_by_status_index" btree (ambulance_status_id, evented_at)
Child tables: tracker_points_2015_06,
tracker_points_2015_07,
and many more
\d+
for target child table (tracker_points_2017_01
):
Table "public.tracker_points_2017_01"
Column | Type | Modifiers | Storage | Stats target | Description
---------------------+-----------------------------+-------------------------------------+----------+--------------+-------------
id | uuid | not null default uuid_generate_v4() | plain | |
tracker_id | uuid | not null | plain | |
data | jsonb | not null default '{}'::jsonb | extended | |
evented_at | timestamp without time zone | not null | plain | |
created_at | timestamp without time zone | | plain | |
ambulance_status_id | integer | | plain | |
in_zone | boolean | not null default true | plain | |
is_stop | boolean | default false | plain | |
Indexes:
"tracker_points_2017_01_pkey" PRIMARY KEY, btree (id)
"tracker_points_2017_01_ambulance_status_id_evented_at_idx" btree (ambulance_status_id, evented_at)
"tracker_points_2017_01_evented_at_idx" brin (evented_at)
"tracker_points_2017_01_tracker_id_evented_at_idx" btree (tracker_id, evented_at DESC)
"tracker_points_2017_01_tracker_id_idx" btree (tracker_id)
Check constraints:
"pathman_tracker_points_2017_01_4_check" CHECK (evented_at >= '2017-01-01 00:00:00'::timestamp without time zone AND evented_at < '2017-02-01 00:00:00'::timestamp without time zone)
Inherits: tracker_points
Am I configured something wrong? How to debug this?
Thank you in advance.