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 1vTrgw-00CYLF-2R for pgsql-hackers@arkaria.postgresql.org; Fri, 12 Dec 2025 01:11:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vTrgt-00698O-0f for pgsql-hackers@arkaria.postgresql.org; Fri, 12 Dec 2025 01:11:27 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vTrgs-00698F-2o for pgsql-hackers@lists.postgresql.org; Fri, 12 Dec 2025 01:11:27 +0000 Received: from mail-qv1-xf35.google.com ([2607:f8b0:4864:20::f35]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vTrgn-000ERQ-35 for pgsql-hackers@lists.postgresql.org; Fri, 12 Dec 2025 01:11:25 +0000 Received: by mail-qv1-xf35.google.com with SMTP id 6a1803df08f44-88677f91e9dso7300786d6.1 for ; Thu, 11 Dec 2025 17:11:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; t=1765501880; x=1766106680; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=0qhtKw1LwozjIbb0UNRIQ73D8wFC8iYoXlFqBjHvid0=; b=KFGZfBw00PjaTr8aWAWzPDvGbEoXqYnCJR3g3CLiU+ZAenazULYwKR/Mtoqj+j+3SL gmQatc60SvEDLvs4rKNNh0ZRQ1O0Y9YEZEbCLGXgO/P7K7ZKqXSjSRqTU3a9GnA5OWfD 71RJnFhMoIPNriXuuobwyg6YGC66BmsEUuiqLF0/jM0f6X5sIT/ymoJOPafVuJOLa21g 3TuX0EE7+6DLEJdJJ537kEL8j4G8pAIaZawSE0ijQ6oeNKeb9bY+iE4C3o7VCwUEwk+0 y8yaYqZkHMntnm5qnblP+0Z+ZgFZy6YFcwPorkmsos5Ad85kS7tqK5fG+FihGAkhIgBi 1aBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765501880; x=1766106680; h=content-transfer-encoding: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=0qhtKw1LwozjIbb0UNRIQ73D8wFC8iYoXlFqBjHvid0=; b=waCLoR1MEJLzLqb37U01CaPDeNE697d0SEZcQCNa75cQfPlD03StYpqUZVdj3Lcsgc z9CcvKwJzwk6pXnaZpSWeCTDWmV+JhsJIYN/PvUaSkhDFle/PF0Gp8D8psgXnxfMisjV IhcrorXpldbj3/mTm1yTh5Ct7SuOmyrja90F2cTQN1p8F6lIGsYuy9S/ujfg5U2qmWDk qMqkvIEKVm1/VxMAdpARl2Q29MtNAutVj+8lgGBsKNDaouPkrbdKqLMNQD5sSsKVUiFo 1P7YXZ/HlHaP5BDMX4k+mtNje/yvLPh4fSdSnXPwrbF1K2G2zlfKjFqfJpFS0pJXRO+W gA1A== X-Forwarded-Encrypted: i=1; AJvYcCX6DD5OCujh7zA9CKa3L3mDlia4PQ3/DZfICC/Tx8/c9Nz9Wfn6taAj+16MfOJngLOPVWzDA0mhPJuU7vgE@lists.postgresql.org X-Gm-Message-State: AOJu0YxXClHsguJ9U9eyIQDx4eALZjzdtKM29jCOeT7BVUUeSK4QuKPr GDy0z3hsMol2etFiSr2AAU5/KstWO7hUg87736crC8/xFl7JcRuYbSCZJxGW1a8WMs9lhaXsfeb aFrW7stSH94E5VMDbUoAACIexXLfVl2RnihiLSOU2 X-Gm-Gg: AY/fxX5RvsSyJc6iG8aEsT+KG5CtWAMwHuq1vThHT6HMcO+Oafot/MoJmoQMd0tyo8f 264VAyc79tOsWKeSVcGMWFXPlxoJ7HqmBXYLbIAMP+SAsj9+4KKvrFQLhTlNJu7hQ4PqNbwS6dU wMLMzsir9COy3ND/ivw9o8ejmhKYu4iSx0psgVnHLRAay0wgJfr+VmzXIPENXR7kOJC8lOHgo+4 TRs7WKX6pY8FEtZHUhBnQJOLwts+Aff4NFRKlKCFZVGEjqFqvCH40LRf7aOGdj4UId+SKX+7Qit /dCFErmn X-Google-Smtp-Source: AGHT+IEh16cjIQwxELwy+pAYDzzz24/cp6MIIZ0P7gZxEnK7AOWTTVWd1dsL2T/JML2UUUgvnxc4+Xq71K5p3+o/UQI= X-Received: by 2002:ad4:5cee:0:b0:87c:27e2:3c0c with SMTP id 6a1803df08f44-88871599173mr57955586d6.21.1765501880527; Thu, 11 Dec 2025 17:11:20 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Jacob Champion Date: Thu, 11 Dec 2025 17:11:09 -0800 X-Gm-Features: AQt7F2rK_YtaBlv-2wbI16OFHQe558gvVMTXkqtATrWeDxP20o61MpZHVsV7HoA Message-ID: Subject: Re: pg_plan_advice To: Robert Haas Cc: Dian Fay , Matheus Alcantara , Jakub Wartak , PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Dec 9, 2025 at 11:46=E2=80=AFAM Robert Haas = wrote: > By the way, if your fuzzer can also > produces some things to add contrib/pg_plan_advice/sql for cases like > this, that would be quite helpful. Ideally I would have caught this > with a manually-written test case, but obviously that didn't happen. Sure! (They'll need to be golfed down.) Here are three entries that hit the crash, each on its own line: > join_order(qoe((nested_l oindex_scanp_plain))se(nested_loop_plain)nested_= loo/_pseq_scanlain) > join_order(qoe((nested_loop_plain))se(nested_loop_plain)nesemij/insted_lo= op_plain) > gather(gather(gar(g/ther0))gtaher(gathethga)) Something the fuzzer really likes is zero-length identifiers (""). Maybe that's by design, but I thought I'd mention it since the standard lexer doesn't allow that and syntax.sql doesn't exercise it. > > It doesn't know that area is guaranteed to be non-NULL, so it can't > > prove that ca_pointer is initialized. > > I don't know what to do about that. I can understand why it might be > unable to prove that, but I don't see an obvious way to change the > code that would make life easier. I could add Assert(area !=3D NULL) > before the call to pgpa_make_collected_advice() if that helps. With USE_ASSERT_CHECKING, that should help, but I'm not sure if it does without. (I could have sworn there was a conversation about that at some point but I can't remember any of the keywords.) Could also just make a dummy assignment. Or tag pg_plan_advice_dsa_area() with __attribute__((returns_nonnull)), but that's more portability work. --Jacob