I would like to create a trigger which gets fired once a table is created in a schema. This trigger should add a comment to the newly created table, something like:
CREATE TRIGGER my_trigger
AFTER CREATE ON my_schema
EXECUTE PROCEDURE add_comment;
With add_comment
doing somthibg like:
...
BEGIN
EXECUTE '
COMMENT ON TABLE ' || new_table || ' IS ''Created by ' || CURRENT_USER || ' on ' || CURRENT_TIME ''';
';
However, it seems I can only add triggers on table level. How could I achieve to add comments to newly created tables in pure Postgres?