{"action":"closed","issue":{"url":"https://api.github.com/repos/keithf4/pg_partman/issues/62","labels_url":"https://api.github.com/repos/keithf4/pg_partman/issues/62/labels{/name}","comments_url":"https://api.github.com/repos/keithf4/pg_partman/issues/62/comments","events_url":"https://api.github.com/repos/keithf4/pg_partman/issues/62/events","html_url":"https://github.com/keithf4/pg_partman/issues/62","id":89374354,"number":62,"title":"Split premake & trigger coverage into separate config options (WAS: drop_partition_id() doesn't recreate trigger functions which mention the dropped partition)","user":{"login":"IMSoP","id":667364,"avatar_url":"https://avatars.githubusercontent.com/u/667364?v=3","gravatar_id":"","url":"https://api.github.com/users/IMSoP","html_url":"https://github.com/IMSoP","followers_url":"https://api.github.com/users/IMSoP/followers","following_url":"https://api.github.com/users/IMSoP/following{/other_user}","gists_url":"https://api.github.com/users/IMSoP/gists{/gist_id}","starred_url":"https://api.github.com/users/IMSoP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IMSoP/subscriptions","organizations_url":"https://api.github.com/users/IMSoP/orgs","repos_url":"https://api.github.com/users/IMSoP/repos","events_url":"https://api.github.com/users/IMSoP/events{/privacy}","received_events_url":"https://api.github.com/users/IMSoP/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/keithf4/pg_partman/labels/feature%20request","name":"feature request","color":"84b6eb"},{"url":"https://api.github.com/repos/keithf4/pg_partman/labels/fixed%20in%20current%20release","name":"fixed in current release","color":"006b75"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-06-18T19:16:33Z","updated_at":"2015-10-26T16:16:24Z","closed_at":"2015-10-26T16:16:24Z","body":"When partitions are dropped by run_maintenance() / drop_partition_id(), the corresponding trigger function is not rebuilt, so still contains references to the dead partition. \r\n\r\nThis means that new inserts within the non-retained range have rather unwelcome behaviour: If the table is just disinherited, the insert will proceed, but not be visible afterwards. If the table is dropped or moved, the trigger function will raise an error.\r\n\r\nExample: the following will produce `ERROR: relation \"public.test_p0\" does not exist`:\r\n\r\n```\r\ncreate table test ( id serial, value text not null );\r\n\r\nselect partman.create_parent('public.test', 'id', 'id', '100');\r\n\r\nupdate partman.part_config set partition_interval = '100'::text;\r\nupdate partman.part_config set retention = '200'::text;\r\nupdate partman.part_config set retention_keep_table = false;\r\n\r\ninsert into test ( value )\r\nselect 'test1: ' || generate_series(0, 500);\r\n\r\nselect partman.run_maintenance();\r\n\r\nselect min(id), max(id) from test;\r\n\r\ninsert into test ( id, value )\r\nvalues ( 10, 'invalid' );\r\n```"}}