From: | AJ Welch <awelch0100(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | pg_get_triggerdef does not use the schema qualified procedure name |
Date: | 2019-09-26 20:01:57 |
Message-ID: | CAO-RzRKjN6oZjDSyBoVbtfsup9hVpqsOaP7fRWN_5qXMx1kPDA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi,
I noticed that pg_get_triggerdef doesn't seem to use the schema qualified
name of procedures/functions. Is it supposed to? Is there a way to get it
to?
z1h=# \x auto
Expanded display is used automatically.
z1h=# select tg.tgname "name", nsp.nspname "schema", cls.relname table_name,
pg_get_triggerdef(tg.oid) full_definition, proc.proname proc_name,
nspp.nspname proc_schema, tg.tgenabled enabled
from pg_trigger tg
join pg_class cls on cls.oid = tg.tgrelid
join pg_namespace nsp on nsp.oid = cls.relnamespace
join pg_proc proc on proc.oid = tg.tgfoid
join pg_namespace nspp on nspp.oid = proc.pronamespace
where not tg.tgisinternal
order by schema, table_name, name;
-[ RECORD 1
]---+---------------------------------------------------------------------------------------------------------------------
name | users_updated_at
schema | z1h
table_name | users
full_definition | CREATE TRIGGER users_updated_at BEFORE UPDATE ON
z1h.users FOR EACH ROW EXECUTE PROCEDURE update_updated_at_column()
proc_name | update_updated_at_column
proc_schema | public
enabled | O
This causes problems for tools like migra
<https://djrobstep.com/docs/migra> that
try to use the output of pg_get_triggerdef to recreate triggers that were
defined in schemas other than public.
Thanks,
AJ
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2019-09-26 22:47:31 | Re: pg_get_triggerdef does not use the schema qualified procedure name |
Previous Message | Adrian Klaver | 2019-09-26 19:02:31 | Re: row_to_json white space |