I’m trying to create a partition in a PostgreSQL table for year and month. I want to archive data in S3 based on these partitions, using separate folders for each year and month. However, including the partition key in the primary key seems to be a requirement. I only need year and month (YYYY-MM format) in the partition key, not the day and time.
I’ve tried using to_char(datetime, ‘YYYY-MM’) in the partition key, but it’s not working. I also tried adding a generated column to hold just the year and month data, but that didn’t work either. Can you help me get this working?
2