| From: | Ajin Cherian <itsajin(at)gmail(dot)com> |
|---|---|
| To: | SATYANARAYANA NARLAPURAM <satyanarlapuram(at)gmail(dot)com> |
| Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: [PATCH] Fix NULL dereference in subscription REFRESH on concurrent DROP |
| Date: | 2026-06-01 06:29:52 |
| Message-ID: | CAFPTHDbTRuxqG0J_tnUB5UbYQF-wM6QPyiSJe3FQb89Op5xP_Q@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Sun, May 24, 2026 at 5:57 PM SATYANARAYANA NARLAPURAM <
satyanarlapuram(at)gmail(dot)com> wrote:
> Hi Hackers,
>
> ALTER SUBSCRIPTION ... REFRESH PUBLICATION may crash if a
> subscribed table (or sequence) is dropped concurrently.
>
> In check_publications_origin_tables(), the function iterates over
> subrel_local_oids without holding locks on the individual relations.
> If a table is dropped by another session between when the OID list was
> collected and when get_rel_name() is called, it returns NULL. That
> NULL is then passed to quote_literal_cstr(), which dereferences it
> unconditionally, causing a segfault. The same pattern exists in
> check_publications_origin_sequences() as well.
>
> Attached a patch to fix this by doing a null check after get_rel_name() and
> get_namespace_name(), and skip the relation if it's gone.
>
> Thanks,
> Satya
>
Hi Satya,
I've reviewed the patch and it looks good, just a small comment - instead
of silently continuing after finding a dropped local table, would you want
to log an error message?
regards,
Ajin Cherian
Fujitsu Australia
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Kyotaro Horiguchi | 2026-06-01 06:30:58 | Re: pg_rewind does not rewind diverging timelines |
| Previous Message | liu zhilong | 2026-06-01 06:10:51 | [PATCH] doc: explain database-wide impact of old xmin on VACUUM |