Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wCDf0-001lwz-1A for pgsql-hackers@arkaria.postgresql.org; Mon, 13 Apr 2026 09:32:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wCDey-0060nD-1f for pgsql-hackers@arkaria.postgresql.org; Mon, 13 Apr 2026 09:32:49 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wCDey-0060n5-0k for pgsql-hackers@lists.postgresql.org; Mon, 13 Apr 2026 09:32:49 +0000 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wCDew-00000000oLT-3oLO for pgsql-hackers@postgresql.org; Mon, 13 Apr 2026 09:32:48 +0000 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-43cff5dafc3so3003020f8f.1 for ; Mon, 13 Apr 2026 02:32:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1776072765; cv=none; d=google.com; s=arc-20240605; b=DmpMAUyk/Y684MushqEMeRYsOBJJfstwGMLlc5IbmAJGc3vhLHh7WNf+UsuV6iyRdF HauF8QLWDV3HUJBLuWBcIqSZFEYSbYYO/CegrDzip5M5px6Ey7T1nsRr+ERxmm7jPDuB L54BdqdIZ7rcfQy2aS4qTMWWUgQ0gOjk3pp+IqLT5tkbjkJcK77kpFQvGcfwE54P3nbQ f+YCXewPXYOSI8ceOODWkvLAZlPKM3v4YMHL0sArE0K03cKk2ww/mnqtZjllqXEiJib8 /tBDqPLca8vklZU5q7xfAaBc8WcisjOqoByYc46YJopNPvCx3BkhuQhPZDiQznmSIY3b LZHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=3ZZeP/sSexhps4b3VR1SnIqKIxKr9o6NJ59V1wRII1s=; fh=qSJsZD8AMIawn1/Kh/UckT9T7ONulmOmBrtK2ismc4Y=; b=X26yf73hz3IwZxGOPcwl5lKpfuKW/buaM3qOyn3lm7KNNGQBPjd4VGnYg9TzGaEuPs W86B7CKKoe7BSll7QWaJzsK63rV6PwgZDm0iKqGeGtRNLMhwZ/Lnj+/1qFcdYL0cX+l3 pt1TuAaUN02q5vmUhx4fEjXgjR7NQVBoC9gGumJgBBwi0uCbR9HLy2uJGJIkYPm1kWiR mL3km0yj7UhWW/ByUH6XJizUCm6yoJeLhCr8hZMbgJmxX2XSVq2ov6JDoD2pjtwHiJfB rQ+wKltSyjJ6S4yanjfOOjp4G5wKc88+Ix8Hj4tzoyOV8S0RiEYvC3h7Z9KDyBA4tzD3 UN4g==; darn=postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1776072765; x=1776677565; darn=postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=3ZZeP/sSexhps4b3VR1SnIqKIxKr9o6NJ59V1wRII1s=; b=dL0FFhV5D2nT/uMT32FXvq2e/5kfkIEMPjVkJHTdjvUOEZTgRxNo19QozjOYt8AoNN FPbVHJB5wdZRey5KDgUNqrD9SmapW9x/sAPtWBs7pIIKFQnq1VBWGmVLfFRMhgHxiv7U Fj+lLPg+vKEAgsNcuzsO0dx+w3DIMU1L/VzFAQ/R2/UzWJYt/ChOMtiFlJ8/UG1npY8Y Ia2CBhQmpr5Ge1WhOr7PWGpIe3O1SWt5BytYDwAhicrxbiArrCPgwkrmkccz4HWp/YBG B5FGUEH4/XF/4eIad82Is0IxcFBmyd+UG8Lc3veFJs5LXuv8jHoja6funnTX223Ys7vp hFjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776072765; x=1776677565; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=3ZZeP/sSexhps4b3VR1SnIqKIxKr9o6NJ59V1wRII1s=; b=n+qXAEBfog9GDmG/6TK0S8fnwD+Je1ODi3TgN8QKPuEEVrw3MJEyF7Uom80LTm3VKt ohktvh1iiKWHy7Da50aYk+pcil9kD3ZCHxDE8DWc2w/0+qh0V+EritBvC+9bVMc0POgl AC0UG+GlJ/coB56oPAk4bunvzm07fWZED9bw7nXSEgQj15K4VoYV4VuLnGPNqLANpDW4 Q6GDGe54ZcKIu6LwfVHWHThVVCfx5eAh2CsyDVzWmRNz2Yamek0eDYDtspChlsNFUcoF f/kkAgG7J/UM811vnOLrWehbpOnSXKaVdS3BZUrN0yitIoSEEYgV6U3GS0x9+iwKq5E5 nXwQ== X-Gm-Message-State: AOJu0Yxn27HAVqRvuKsNy8pTyfHQP5VnYhvCX9D7WKyuM4HLmUAHxc6j g4/Yw6gJipLmbJWo5sjIkZv7HZasD8Cej6eeBMwWWAA+AfVvB0yXRoLC8FdfQIa8XbaT6Aj3FdV /UOo4JhzuHRAMj2TmZaBR3FEK+UKEalRmrl9r X-Gm-Gg: AeBDiesl9fCtyjB5vFLccxkhiF5R7wtPu7vDOqCuyylh8yIfZTwqy26tdqQq87S9/pF r7iS5c8tfdYBEpoPEw9pzl6ApPsT3D/oD94mHQpdvZFLeHVjeI5wdWt5lFUL7rLbbGpIhC6PsJC jA3R9lq1AOcXs3jfannd7Aakytapsv96kEs5f8agNh8pUJMtRzcrm+gnrA2Ti1SM7LZUjhRbRNk p4mn8+ll/IhgWpGOflp3G+hxJT7TlmE/+mmNPnuEtS0C+3AK+BmEMIrIUi6vqAL0LX+fR/VwXhp TReP94MPpT7dsmffidDnPiRgInFvxoJw5x9sK2vzglZYnleHhinRMztBszg58L/ee31Gk3Ewfw= = X-Received: by 2002:a05:6000:144c:b0:43d:761e:e57a with SMTP id ffacd0b85a97d-43d761ee6dbmr6764751f8f.1.1776072764378; Mon, 13 Apr 2026 02:32:44 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: David Rowley Date: Mon, 13 Apr 2026 21:32:32 +1200 X-Gm-Features: AQROBzDfvVGB1v4ZOl3VIyuVt4YOz--szX0iKKM6C5BLeKYErT5TelrlQPD4x4I Message-ID: Subject: Re: [PATCH] Fix NULL dereference in pg_get_database_ddl() To: Ayush Tiwari Cc: pgsql-hackers@postgresql.org Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sat, 11 Apr 2026 at 01:58, Ayush Tiwari wrote: > Deterministic reproduction: > > CREATE DATABASE regression_testdb; > SET allow_system_table_mods = on; > UPDATE pg_database > SET dattablespace = 99999 > WHERE datname = 'regression_testdb'; > RESET allow_system_table_mods; > > SELECT * FROM pg_get_database_ddl('regression_testdb'); > > The attached patch fixes this by checking for NULL before calling > pg_strcasecmp(). In that case, pg_get_database_ddl() simply omits the > TABLESPACE clause. Can you explain why this method of self-inflicted catalogue corruption is any more important than any of the just-about-infinite other ways there are of causing issues by manually updating the catalogue tables? The typical response to this sort of thing can be seen in the thread in [1], in particular, the response in [2]. David [1] https://www.postgresql.org/message-id/19383-e6b60ec2a4fce5b0@postgresql.org [2] https://www.postgresql.org/message-id/1538113.1768921841%40sss.pgh.pa.us