Re: Partitioning documentation example
От | Bruce Momjian |
---|---|
Тема | Re: Partitioning documentation example |
Дата | |
Msg-id | 200801041654.m04GsmD17385@momjian.us обсуждение исходный текст |
Ответ на | Re: Partitioning documentation example (Simon Riggs <simon@2ndquadrant.com>) |
Список | pgsql-docs |
Simon Riggs wrote: > On Fri, 2008-01-04 at 10:27 -0500, Bruce Momjian wrote: > > > It seems to me it would be much clearer if we added a second example > > that used to_char() to create the INSERT statement dynamically based on > > NEW.logdate: > > > > CREATE OR REPLACE FUNCTION measurement_insert_trigger() > > RETURNS TRIGGER AS $$ > > BEGIN > > EXECUTE 'INSERT INTO measurement_y' || to_char(NEW.logdate,'YYYY_mMM') || ' VALUES (NEW.*)'; > > END; > > $$ > > LANGUAGE plpgsql; > > > > It will of course fail if the table does not exist, which I think is > > what we want. This trigger function would not have to be modified when > > new tables are added. > > I like your new trigger better than the old, but I am still > uncomfortable with recommending we use triggers with COPY for > performance reasons and we should add a caveat. OK, I will add this example in addition to the examples already present. -- Bruce Momjian <bruce@momjian.us> http://momjian.us EnterpriseDB http://postgres.enterprisedb.com + If your life is a hard drive, Christ can be your backup. +
В списке pgsql-docs по дате отправления: