Re: DDL Partitionion Inheritance -- improved trigger function
От | David Rowley |
---|---|
Тема | Re: DDL Partitionion Inheritance -- improved trigger function |
Дата | |
Msg-id | CAApHDvqfd+ekEePHjVU--WwCZ0RDHUGWfd2qH3t_tyO1oBqUrg@mail.gmail.com обсуждение исходный текст |
Ответ на | DDL Partitionion Inheritance -- improved trigger function (Kirk Parker <khp@equatoria.us>) |
Ответы |
Re: DDL Partitionion Inheritance -- improved trigger function
|
Список | pgsql-docs |
On Wed, 24 Sept 2025 at 04:25, Kirk Parker <khp@equatoria.us> wrote: > I'm a big fan of maintenance-free functions. What would you think about adding the following as an alternative triggerfunction, or as a replacement for the current function, to > https://www.postgresql.org/docs/current/ddl-partitioning.html#DDL-PARTITIONING-INHERITANCE-EXAMPLE , item #5? > > CREATE OR REPLACE FUNCTION measurement_insert_trigger() > RETURNS TRIGGER AS $$ > BEGIN > EXECUTE format('INSERT INTO measurement_%s VALUES (NEW.*)', to_char( NEW.logdate, 'YYYYMM')); > RETURN NULL; > END; > $$ > LANGUAGE plpgsql; I've somewhat mixed feelings about that. While I do agree that it might be a good way to code things to help prevent a DBA from a midnight callout, I'm just not sure I'm that onboard with adding the example. About 10 years ago, I'd likely just have agreed, but since then we've got declarative partitioning and the legitimate use cases for using inheritance partitioning over the newer method are very limited. Today when I look at that page in the documents, I wonder how we could write less about inheritance partitioning or if we could move the inheritance section out into another page rather than having it mixed up with the declarative partitioning sections, perhaps headed up with a note to redirect people to the declarative partitioning section. I fear adding your proposed example might increase the chances of someone landing on that section if they're skimming the page. Overall, I'm about -0.01 on your idea. I might be in favour of it if the inheritance section had a dedicated page. David
В списке pgsql-docs по дате отправления: