Re: Event Triggers: adding information
От | Dimitri Fontaine |
---|---|
Тема | Re: Event Triggers: adding information |
Дата | |
Msg-id | m2zk1j9c44.fsf@2ndQuadrant.fr обсуждение исходный текст |
Ответ на | Event Triggers: adding information (Dimitri Fontaine <dimitri@2ndQuadrant.fr>) |
Ответы |
Re: Event Triggers: adding information
|
Список | pgsql-hackers |
Hi again, The previously attached patch already needs a rebase since Tom fixed the single user mode where you're not supposed to access potentially corrupted system indexes. Please find attached a new version of the patch that should applies cleanly to master (I came to trust git). Dimitri Fontaine <dimitri@2ndQuadrant.fr> writes: > The current patch provides the following features: > > - New events: ddl_command_end and ddl_command_trace > > - New information in the TG_VARIABLE: > object name, schema name, object id, object kind, > operation (CREATE|ALTER|DROP), context (GENERATED|TOPLEVEL|…) > normalized command string > > - New event filtering on CONTEXT (see after sig for an example) > > + create event trigger regress_event_trigger_end on ddl_command_end > + when context in ('toplevel', 'generated', 'query', 'subcommand') > + execute procedure test_event_trigger(); > > - Documentation of listed features > > - pg_dump support of the new features (context support) Still the same, plus some more command rewriting support so that I have some more data points to offer about the code maintainance burden we all want to limit on that feature. > For example, I added CREATE SCHEMA objectid and command normalisation > and here's the footprint: > 4 files changed, 38 insertions(+), 5 deletions(-) > > For the whole DefineStmt command set (CREATE AGGREGATE, OPERATOR, TYPE, > TEXT SEARCH *, COLLATION), we're talking about: > 11 files changed, 186 insertions(+), 70 deletions(-) > 95 lines of those in ddl_rewrite.c > > For the normalisation of CREATE CONVERSATION command string, this time > 4 files changed, 40 insertions(+), 5 deletions(-) > > And CREATE DOMAIN, which is more involved as you need to take care of > rewriting DEFAULT and CHECK constraints, we have > 4 files changed, 163 insertions(+), 3 deletions(-) The whole set of RenameStmt commands: 32 files changed, 382 insertions(+), 119 deletions(-) Then after that, sharing a lot of the previous code, support for both AlterOwnerStmt and AlterObjectSchemaStmt rewriting: 1 file changed, 102 insertions(+), 17 deletions(-) As you can guess I separated away the EventTriggerTargetOid tracking: 20 files changed, 96 insertions(+), 57 deletions(-) Again, those data point are not commented here, it's only to get some better idea of what we are talking about as the cost of maintaining the new command normalisation feature that's brewing in this patch. I would like that we commit to that idea and the current implementation of it, and include the set of commands I already had time to prepare in the current submission, knowing that I will continue adding commands support up to the next commitfest with the goal to have a full coverage. I also will be working on more features (complete PL support, some kind of command diverting, a "table_rewrite" event, some ready to use event triggers functions). Regards, -- Dimitri Fontaine http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support
Вложения
В списке pgsql-hackers по дате отправления: