public inbox for [email protected]  
help / color / mirror / Atom feed
From: senor <[email protected]>
To: pgsql-general@lists <[email protected]>
Subject: sequence on daily log partitioned table
Date: Tue, 22 Apr 2025 04:26:10 +0000
Message-ID: <LV8P220MB09555DBF54A6F74131D92D88F7BB2@LV8P220MB0955.NAMP220.PROD.OUTLOOK.COM> (raw)

Hi All,

I'm mainly interested in understanding how this works or why it can't, as opposed to just solving the problem. AI just told me this can't be done without a trigger but I'd like to confirm in case maybe I just asked the wrong question.

I want to have a partitioned log table receiving input from sensor equipment. The partitions would cover some time range like an hour or day. In all cases I want an ID column to default to a nextval from a sequence but starting over for each day. If I set the default on the partitioned table, I would need to alter it at midnight - not optimal. A default set on the partition hasn't worked and I'm not sure why this is a problem.

I've only ever used simplistic partitioning but this doesn't seem like an unusual need. I'm looking for the underlying strategy that prevents use of the sequence configured on the partition. A reference to something describing the decision flow would be fantastic.

I've been experimenting on version 13 out of convenience but if a newer version has relevant changes, I'm interested. I'm not interested in the discussions over whether the data volume is enough to justify partitioning.

Thanks in advance,
Senor


reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: sequence on daily log partitioned table
  In-Reply-To: <LV8P220MB09555DBF54A6F74131D92D88F7BB2@LV8P220MB0955.NAMP220.PROD.OUTLOOK.COM>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox