public inbox for [email protected]help / color / mirror / Atom feed
Add null check on get_tablespace_name() return in pg_get_database_ddl_internal 3+ messages / 2 participants [nested] [flat]
* Add null check on get_tablespace_name() return in pg_get_database_ddl_internal @ 2026-04-22 22:20 SATYANARAYANA NARLAPURAM <[email protected]> 0 siblings, 1 reply; 3+ messages in thread From: SATYANARAYANA NARLAPURAM @ 2026-04-22 22:20 UTC (permalink / raw) To: PostgreSQL Hackers <[email protected]> Hi Hackers, A concurrent tablespace drop could lead to null deref in pg_get_database_ddl. I acknowledge this is a corner case. Adding a patch to fix this to keep the code clean. Thanks, Satya Attachments: [application/octet-stream] 0001-Fix-NULL-deref-in-pg_get_database_ddl-on-concurrent-tablespace-drop.patch (558B, 3-0001-Fix-NULL-deref-in-pg_get_database_ddl-on-concurrent-tablespace-drop.patch) download | inline diff: diff --git a/src/backend/utils/adt/ddlutils.c b/src/backend/utils/adt/ddlutils.c index d83cda33..cc7511e8 100644 --- a/src/backend/utils/adt/ddlutils.c +++ b/src/backend/utils/adt/ddlutils.c @@ -986,7 +986,8 @@ pg_get_database_ddl_internal(Oid dbid, bool pretty, { char *spcname = get_tablespace_name(dbform->dattablespace); - if (pg_strcasecmp(spcname, "pg_default") != 0) + if (spcname != NULL && + pg_strcasecmp(spcname, "pg_default") != 0) append_ddl_option(&buf, pretty, 4, "TABLESPACE = %s", quote_identifier(spcname)); } ^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Add null check on get_tablespace_name() return in pg_get_database_ddl_internal @ 2026-04-23 00:03 Chao Li <[email protected]> parent: SATYANARAYANA NARLAPURAM <[email protected]> 0 siblings, 1 reply; 3+ messages in thread From: Chao Li @ 2026-04-23 00:03 UTC (permalink / raw) To: SATYANARAYANA NARLAPURAM <[email protected]>; +Cc: PostgreSQL Hackers <[email protected]> > On Apr 23, 2026, at 06:20, SATYANARAYANA NARLAPURAM <[email protected]> wrote: > > Hi Hackers, > > A concurrent tablespace drop could lead to null deref in pg_get_database_ddl. I acknowledge this is a corner case. Adding a patch to fix this to keep the code clean. > > Thanks, > Satya > <0001-Fix-NULL-deref-in-pg_get_database_ddl-on-concurrent-tablespace-drop.patch> This is a dup of my recent patch, see [1]. [1] https://www.postgresql.org/message-id/573E45C1-31A4-4885-A00C-1A2171159A2A%40gmail.com Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/ ^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Add null check on get_tablespace_name() return in pg_get_database_ddl_internal @ 2026-04-23 06:48 SATYANARAYANA NARLAPURAM <[email protected]> parent: Chao Li <[email protected]> 0 siblings, 0 replies; 3+ messages in thread From: SATYANARAYANA NARLAPURAM @ 2026-04-23 06:48 UTC (permalink / raw) To: Chao Li <[email protected]>; +Cc: PostgreSQL Hackers <[email protected]> Hi Chao, On Wed, Apr 22, 2026 at 5:03 PM Chao Li <[email protected]> wrote: > > > > On Apr 23, 2026, at 06:20, SATYANARAYANA NARLAPURAM < > [email protected]> wrote: > > > > Hi Hackers, > > > > A concurrent tablespace drop could lead to null deref in > pg_get_database_ddl. I acknowledge this is a corner case. Adding a patch to > fix this to keep the code clean. > > > > Thanks, > > Satya > > > <0001-Fix-NULL-deref-in-pg_get_database_ddl-on-concurrent-tablespace-drop.patch> > > This is a dup of my recent patch, see [1]. > > [1] > https://www.postgresql.org/message-id/573E45C1-31A4-4885-A00C-1A2171159A2A%40gmail.com Thanks, I replied there. ^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2026-04-23 06:48 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-04-22 22:20 Add null check on get_tablespace_name() return in pg_get_database_ddl_internal SATYANARAYANA NARLAPURAM <[email protected]> 2026-04-23 00:03 ` Chao Li <[email protected]> 2026-04-23 06:48 ` SATYANARAYANA NARLAPURAM <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox