Skip to content

How can I drop the data from default partition with retention rule? #778

Answered by keithf4
ivandedkov asked this question in Q&A
Discussion options

You must be logged in to vote

This is a rather uncommon operation and I'd rather not add this sort of logic into partman. It's probably better to handle at the application level even though that's not what you want to do right now. Either by better validating the data that's getting inserted or catching the expected exception that is returned when data is inserted outside the existing children with no default.

Or again you could schedule a pg_cron job that runs on a regular basis to truncate the default. Just be careful since I'm not 100% of the lock that that operation would do on the partition set as a whole.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@ivandedkov
Comment options

@keithf4
Comment options

Answer selected by ivandedkov
@ivandedkov
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #777 on May 15, 2025 13:35.