Re: [PATCH] Fix memory corruption in pg_shdepend.c

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [PATCH] Fix memory corruption in pg_shdepend.c
Дата
Msg-id 2420185.1634831528@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [PATCH] Fix memory corruption in pg_shdepend.c  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Ответы Re: [PATCH] Fix memory corruption in pg_shdepend.c  ("David G. Johnston" <david.g.johnston@gmail.com>)
Re: [PATCH] Fix memory corruption in pg_shdepend.c  (Aleksander Alekseev <aleksander@timescale.com>)
Список pgsql-hackers
Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> I suppose pg_describe_object can be used on the contents of pg_shdepend
> to detect it.  I'm less sure what to do to correct it -- delete the
> bogus entries and regenerate them with some bulk query?

Seems that what copyTemplateDependencies wants to do can easily be
modeled by a SQL query, assuming you know which DB was cloned to
which other one, and that the source's shdeps didn't change since
then.  However, I'm not sure how we can get rid of existing bogus
entries, especially if we'd like to preserve not-bogus ones
(which very likely have gotten added to the destination DB since
it was created).

On the whole I'm afraid that people messing with this manually are
likely to do more harm than good.  pg_shdepend entries that don't
match any object probably won't cause a problem, and the lack of
protection against untimely dropping a role is unlikely to be much
of an issue for a role you're referencing in a template database.
So I suspect that practical issues will be rare.  We're fortunate
that cloning a nonempty template database is rare already.

BTW, I think there is an additional bug in copyTemplateDependencies:
I do not see it initializing slot->tts_isnull[] anywhere.  It
probably accidentally works (at least in devel builds) because we zero
that memory somewhere else, but surely this code shouldn't assume that?

            regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Japin Li
Дата:
Сообщение: Re: [Bug] Logical Replication failing if the DateStyle is different in Publisher & Subscriber
Следующее
От: Matthias van de Meent
Дата:
Сообщение: Re: Adding CI to our tree