Batch upserts in child tables of a partition set created using pg partman

Specify an action for ON CONFLICT while creating partition set

select partman.create_parent(p_parent_table := 'public.users', 
p_control := 'created_at',
p_type := 'partman',
p_interval := 'daily',
p_automatic_maintenance := 'on',
p_upsert := 'ON CONFLICT (id) DO UPDATE SET email =, last_name = EXCLUDED.last_name, updated_at = EXCLUDED.updated_at',
p_debug := TRUE);

Insert statement that will cause violation error

insert into users 
(id, first_name, last_name, email, created_at, updated_at)
values (1, 'foo', 'bar', '', now(), now()),
(2, 'abc', 'pqr', '', now(), now());



Product Engineer at Gojek.

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store