Re: Trigger (or something similar) on table rename?

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: Trigger (or something similar) on table rename?
Дата
Msg-id ad647f03-2729-1b10-ad13-16724ec222b4@aklaver.com
обсуждение исходный текст
Ответ на Trigger (or something similar) on table rename?  (Ken Tanzer <ken.tanzer@gmail.com>)
Список pgsql-general
On 02/15/2018 10:52 AM, Ken Tanzer wrote:
> Hi.  I'm wondering about possibilities for taking action when a table is 
> renamed.
> 
> Specifically in this case, I'm using table_log, which when you use it on 
> a table creates a new table, sequence and index that is tied to the 
> table name.  Of course, if the oriignal table is renamed, the other 
> relations aren't.  So I rename table to table_old, and then create a new 
> version of table, but the table logging fails because of the 
> already-existing relations that table_log created.
> 
> I could of course rename them manually, or create a function to do it, 
> but that would still need to be manually invoked.  I haven't really used 
> listen/notify--I assume it could do this, but there would need to be 
> some kind of process actively listening?
> 
> Something like a trigger on the table rename would be ideal for my 
> purposes.  Anything like that possible?  Thanks!
> 
> Ken
> 
> -- 
> AGENCY Software
> A Free Software data system
> By and for non-profits
> /http://agency-software.org//
> /https://demo.agency-software.org/client/
> ken.tanzer@agency-software.org <mailto:ken.tanzer@agency-software.org>
> (253) 245-3801
> 
> Subscribe to the mailing list 
> <mailto:agency-general-request@lists.sourceforge.net?body=subscribe> to
> learn more about AGENCY or
> follow the discussion.

Maybe?:

https://www.postgresql.org/docs/9.6/static/event-triggers.html

https://www.postgresql.org/docs/9.6/static/plpgsql-trigger.html#PLPGSQL-EVENT-TRIGGER

-- 
Adrian Klaver
adrian.klaver@aklaver.com


В списке pgsql-general по дате отправления:

Предыдущее
От: Ken Tanzer
Дата:
Сообщение: Trigger (or something similar) on table rename?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Trigger (or something similar) on table rename?