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 1vU74H-00HKkj-2s for pgsql-hackers@arkaria.postgresql.org; Fri, 12 Dec 2025 17:36:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vU74E-008oeu-1W for pgsql-hackers@arkaria.postgresql.org; Fri, 12 Dec 2025 17:36:35 +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 1vU74E-008oel-0b for pgsql-hackers@lists.postgresql.org; Fri, 12 Dec 2025 17:36:34 +0000 Received: from mail-ej1-x62b.google.com ([2a00:1450:4864:20::62b]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vU74C-000OXb-0v for pgsql-hackers@lists.postgresql.org; Fri, 12 Dec 2025 17:36:34 +0000 Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-b76b5afdf04so273796366b.1 for ; Fri, 12 Dec 2025 09:36:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1765560990; x=1766165790; 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=/5SkLUfm/FUP1uzPJuL4cmNwYCghtXuY/5qEwgFm4bk=; b=j8GsuB/D216xfaa2fdRmy3U/tBDEo/FCE2oCwxX4qazVhrjIlRH6Mq37ZBRWBNKQyt u/mK+1cAqhwh3ApVqQ7uMIAbu1y32dXb4fiqZHG9t4q6DxDWdjZwttqjQ+Xb8NGAAi1v Yf0cPufANHXUcNkxCe+s0MP/E9x4Hux9QsMXSH+Q+lspuDDKC4JFypd3bJZb7ja177nZ 9cEjjspxJe2VeptEavh7sZBfFPZAup3cXFWUta7fhkR62AgJ+Qh7x00YS7ptpw9Cjziy ULGpnenepMpmlEYHvRwZbN7mujITJKgwghCOueBRwXgdb5UcqVmXUI9OhpxqFbrqDgow RnQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765560990; x=1766165790; 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=/5SkLUfm/FUP1uzPJuL4cmNwYCghtXuY/5qEwgFm4bk=; b=Av1qVqngGUTHJnyUYo2ItF4os9MIwFdgxq4w9lkvkXGelTM4s/mkbrBd3rSCSe7l7r jfhfKp2i66p/YdWvk+xkSY2U4Z9GapN6KY3lr6kIPG5KNKck1mhh2dVo/MrTvvP2u0ac hmO1FuwmeY67eVXy/TPfoV7HRRlJkSOIMtwtAe7WwYPLdtlV6rGgxAY1sdCYAcuRskGo hCddQw7aTIty7odt7kCIaxfpX3YzYIwauyqtOk9ag6iYkRZCxAEaxk83C/fmof4MRL4X gyHC3/Tg0+BqBvx+KTguQ0+ddjSFIePk6euyM64q+k3qZzTmi/5Cx1faswa3nxP/gDXN aGng== X-Forwarded-Encrypted: i=1; AJvYcCXNwJiXefKSzM7sqrCTuc3C9yvahholEk1G+k7v/F0LZ7/AZ8SOwjs6nLWwsmQ/r98+2D/mgEFzve8m7IZy@lists.postgresql.org X-Gm-Message-State: AOJu0Yxp9ronO3s/j1EHR9c+0tLFEjeWRmQS0S7xZRCnNRCHjaJbX380 RBi9Qj97nPR0t3m9plSCExsYrGSAu2oVJvR5XH3IJLIFsaeaK3ZfoBrqkmRzkpfKrHQnQ+JjS8y FwhBpJ9nOMrNXtcFeBeVrvdxgoEYeupo= X-Gm-Gg: AY/fxX7A7/BytWMr/bry46WqfQwLGp6QeGJ/Eo9n/Od+bqesP7N77V1rwM8ReWtKFNg vFGIXw9EaBUaWHYaZF7fUS8CFmN9XH2styKp71ksFimAv3E0jExBgoUDOgPcuAwFxb1yKRkQMaq hFIc3ptQ6G1JQZIIFOZPmtmJRFZVMR8WU2vXjcyYAdDSgZ1dgkHle1JaEpxNVC029jQlZ+L2paF 9Vbks9HeYPU2xBLW5UqZpB2UpumL5L6eTfYv31RVRt9/IgFawccLjVebPMZiQt5UdN+gy8TQDZX FzSd1fr9bLB+f4cCL3hU3y5qCCRmJV2aQH1n0g== X-Google-Smtp-Source: AGHT+IFDITBqwRw1rB56xJHbFOEKY93WjIS52KT9s9Qf6IUt+kzrCmIxmzgoOoXY30JbsEb3Vkmudiv6ZtTps/k6HuQ= X-Received: by 2002:a17:907:608f:b0:b73:780d:2bcf with SMTP id a640c23a62f3a-b7d23629118mr292709566b.16.1765560989816; Fri, 12 Dec 2025 09:36:29 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Robert Haas Date: Fri, 12 Dec 2025 12:36:17 -0500 X-Gm-Features: AQt7F2rU_kD6jwZpO18l-fQRaHTaQRwiauU3kVKY4mLMsZTnm1tYporDMBPb2s0 Message-ID: Subject: Re: pg_plan_advice To: Jacob Champion 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 Thu, Dec 11, 2025 at 8:11=E2=80=AFPM Jacob Champion wrote: > 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)neste= d_loo/_pseq_scanlain) > > join_order(qoe((nested_loop_plain))se(nested_loop_plain)nesemij/insted_= loop_plain) > > gather(gather(gar(g/ther0))gtaher(gathethga)) At least for me, setting pg_plan_advice.advice to any of these strings does not provoke a crash. What I discovered after a bit of experimentation is that you get the crash if you (a) set the string to something like this and then (b) run an EXPLAIN. Turns out, I already had a test in syntax.sql that is sufficient to provoke the crash, so, locally, I've added 'EXPLAIN SELECT 1' after each test case in syntax.sql that is expected to successfully alter the value of the GUC. > 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. That's not by design. I've added a matching error check locally. > > > 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. As in initialize ca_pointer to InvalidDsaPointer? --=20 Robert Haas EDB: http://www.enterprisedb.com