Dependences records and comments

Started by Дмитрий Воронинalmost 7 years ago2 messages
#1Дмитрий Воронин
carriingfate92@yandex.ru

<br />Hi, hackers!<div><br /></div><div>When we create/alter object we already add dependency row to pg_depend (or, pg_shdepend) table for object that is depends (e.g. trigger depends on table which it created).</div><div><br /></div><div>But when I add comment on table, no one dependency row is added. Why?<br /><br /></div>

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Дмитрий Воронин (#1)
Re: Dependences records and comments

=?utf-8?B?0JTQvNC40YLRgNC40Lkg0JLQvtGA0L7QvdC40L0=?= <carriingfate92@yandex.ru> writes:

When we create/alter object we already add dependency row to pg_depend
(or, pg_shdepend) table for object that is depends (e.g. trigger depends
on table which it created). But when I add comment on table, no one
dependency row is added. Why?

Comments aren't interesting for dependency purposes: nothing can depend
on a comment, nor does a comment depend on anything but its one owning
object, they aren't relevant for CASCADE/RESTRICT rules, etc. So
tracking them in pg_depend would just bloat pg_depend for little gain.
It's simpler to have hard-wired logic to look for a comment and delete it
when any object is deleted.

regards, tom lane