missing event trigger support functions in 9.3

Started by Pavel Stehuleover 12 years ago7 messages
#1Pavel Stehule
pavel.stehule@gmail.com

Hello

I am writing a article about 9.3. I found so event trigger functions is not
complete. We have only pg_event_trigger_dropped_objects() function. It
looks really strange and asymmetric. Can we implement similar function for
CREATE as minimum to 9.3?

I am expecting so this function should not be too complex - and can be
moved to contrib maybe (if it is too late now).

Regards

Pavel

#2Darren Duncan
darren@darrenduncan.net
In reply to: Pavel Stehule (#1)
Re: missing event trigger support functions in 9.3

On 2013.05.09 10:40 AM, Pavel Stehule wrote:

I am writing a article about 9.3. I found so event trigger functions is not
complete. We have only pg_event_trigger_dropped_objects() function. It looks
really strange and asymmetric. Can we implement similar function for CREATE as
minimum to 9.3?

I am expecting so this function should not be too complex - and can be moved to
contrib maybe (if it is too late now).

Really, the touted new event triggers feature in fact only works for dropping
objects rather than for all DDL or other events? If so, then the feature seems
seriously incomplete. Are drops the main expected use case for the feature,
rather than "tell me when something happened"? -- Darren Duncan

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Dimitri Fontaine
dimitri@2ndQuadrant.fr
In reply to: Darren Duncan (#2)
Re: missing event trigger support functions in 9.3

Darren Duncan <darren@darrenduncan.net> writes:

On 2013.05.09 10:40 AM, Pavel Stehule wrote:

I am expecting so this function should not be too complex - and can be moved to
contrib maybe (if it is too late now).

My understanding is that it's too late even for contrib now.

Really, the touted new event triggers feature in fact only works for
dropping objects rather than for all DDL or other events? If so, then the
feature seems seriously incomplete. Are drops the main expected use case
for the feature, rather than "tell me when something happened"?

The feature is seriously incomplete in 9.3, though not in the way you
describe here. To simplify things, please consider that all we have now
is code infrastructure so that we can make progress in the next
releases. Maybe.

Regards,
--
Dimitri Fontaine
http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#4Pavel Stehule
pavel.stehule@gmail.com
In reply to: Dimitri Fontaine (#3)
Re: missing event trigger support functions in 9.3

2013/5/9 Dimitri Fontaine <dimitri@2ndquadrant.fr>

Darren Duncan <darren@darrenduncan.net> writes:

On 2013.05.09 10:40 AM, Pavel Stehule wrote:

I am expecting so this function should not be too complex - and can be

moved to

contrib maybe (if it is too late now).

My understanding is that it's too late even for contrib now.

Really, the touted new event triggers feature in fact only works for
dropping objects rather than for all DDL or other events? If so, then

the

feature seems seriously incomplete. Are drops the main expected use case
for the feature, rather than "tell me when something happened"?

The feature is seriously incomplete in 9.3, though not in the way you
describe here. To simplify things, please consider that all we have now
is code infrastructure so that we can make progress in the next
releases. Maybe.

I understand and I know, so current state is a maximum what is possible,
but it looks really strange

Pavel

Show quoted text

Regards,
--
Dimitri Fontaine
http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#5Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Darren Duncan (#2)
Re: missing event trigger support functions in 9.3

Darren Duncan wrote:

On 2013.05.09 10:40 AM, Pavel Stehule wrote:

I am writing a article about 9.3. I found so event trigger functions is not
complete. We have only pg_event_trigger_dropped_objects() function. It looks
really strange and asymmetric. Can we implement similar function for CREATE as
minimum to 9.3?

I am expecting so this function should not be too complex - and can be moved to
contrib maybe (if it is too late now).

Really, the touted new event triggers feature in fact only works for
dropping objects rather than for all DDL or other events?

It works for all DDL. It provides complete information for drops, not
other kinds of commands. This will be expanded later.

If so, then the feature seems seriously incomplete.

Feel free to contribute during the 9.4 development cycle.

Your appreciation for the work that already went into this feature is
duly noted.

Are drops the main expected use case for the feature, rather than
"tell me when something happened"?

No. It was what we had time to implement.

--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#6Misa Simic
misa.simic@gmail.com
In reply to: Pavel Stehule (#1)
Re: missing event trigger support functions in 9.3

2013/5/9 Pavel Stehule <pavel.stehule@gmail.com>

Hello

I am writing a article about 9.3. I found so event trigger functions is
not complete. We have only pg_event_trigger_dropped_objects() function. It
looks really strange and asymmetric. Can we implement similar function for
CREATE as minimum to 9.3?

I am expecting so this function should not be too complex - and can be
moved to contrib maybe (if it is too late now).

Regards

Pavel

Maybe as workaround can help:

CREATE OR REPLACE FUNCTION snitch() RETURNS event_trigger AS $$
DECLARE
my_cmd text;
BEGIN
SELECT query FROM pg_stat_activity where pid = pg_backend_pid() INTO
my_cmd;
RAISE NOTICE 'snitch: % % %', tg_event, tg_tag, my_cmd;
END;
$$ LANGUAGE plpgsql;

CREATE EVENT TRIGGER snitch ON ddl_command_start EXECUTE PROCEDURE snitch();

Then based on tg_tag - you can have different rules to take object_name
from my_cmd - or whatever else is needed for additional rules...

Kind Regards,

Misa

#7Darren Duncan
darren@darrenduncan.net
In reply to: Alvaro Herrera (#5)
Re: missing event trigger support functions in 9.3

On 2013.05.09 11:22 AM, Alvaro Herrera wrote:

Darren Duncan wrote:

On 2013.05.09 10:40 AM, Pavel Stehule wrote:

I am writing a article about 9.3. I found so event trigger functions is not
complete. We have only pg_event_trigger_dropped_objects() function. It looks
really strange and asymmetric. Can we implement similar function for CREATE as
minimum to 9.3?

I am expecting so this function should not be too complex - and can be moved to
contrib maybe (if it is too late now).

Really, the touted new event triggers feature in fact only works for
dropping objects rather than for all DDL or other events?

It works for all DDL. It provides complete information for drops, not
other kinds of commands. This will be expanded later.

If so, then the feature seems seriously incomplete.

Feel free to contribute during the 9.4 development cycle.

Your appreciation for the work that already went into this feature is
duly noted.

Sorry if I came across as not appreciating the work already done. I in fact do
appreciate it.

I made a mistake. Please disregard my initial comment.

-- Darren Duncan

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers