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 1vlLli-00AGnl-0a for pgsql-hackers@arkaria.postgresql.org; Thu, 29 Jan 2026 06:44:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vlLlh-006soA-0K for pgsql-hackers@arkaria.postgresql.org; Thu, 29 Jan 2026 06:44:41 +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 1vlLlg-006so2-2X for pgsql-hackers@lists.postgresql.org; Thu, 29 Jan 2026 06:44:41 +0000 Received: from mail-oi1-x22e.google.com ([2607:f8b0:4864:20::22e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vlLle-000000011Fs-3oPQ for pgsql-hackers@lists.postgresql.org; Thu, 29 Jan 2026 06:44:40 +0000 Received: by mail-oi1-x22e.google.com with SMTP id 5614622812f47-45f126d47b8so457228b6e.2 for ; Wed, 28 Jan 2026 22:44:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1769669076; cv=none; d=google.com; s=arc-20240605; b=bM/W2dxHiBSt3O9p2/ZDlmaEPuSWfL9Y4UwI4+Whbe5ZqQ4RMzLCFN8rUj0maYLpMx tjODG5VnsHYfDizCPvAy/t6q61jFpuckZ7vDeGfgv5g0ZzddWrwqLjI0v+8c0oB1L11A xseUOuUUQ+Ab4Ua8a5yQkBb51nB2yPrW+PYhVa1xJ7pSqVtIhweKhRuIxzmy31RQ1lwk rcLtKKbOqgv2cU6XbpvNKCBZyDL9Vzf40RoD6pUx37wbcxzEdGGcO8vOxrqonOu2XTeF RHb++rYUgmg8sJiVNF8HAS7h2wZOVi2HtbtqcRHwxxjCHkDzcgtcIobxNCpeAz9eKgcu G/qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=WYAz/j+9fRnOHttjwrINFSMbPeMLyFoZkjOTXwJd+qY=; fh=3NbLeYaUUJeNPDM1WHQ9UPQem0iZPXf9Upfw/6eZ5q4=; b=ipyYGOiL+qMYBpuzCGepcellaPdIH2XBTaxWObuYNvj0+SDYl/zsoXYtg3zjLbIYLT 5kmxkHKZyb5tBC7LtZEont4BAA9fJxSSmec2q/VpqwaLhNix1D+c4M0KbV9AxNZAO5yr AcBAeesOHMLAaJZ9DUkXoBDbxFNrTCMO3PW/467c7AX802S4UyA6shSOqgLT5Fk4roKL 44T1eqfDsA51KnH6WROrGFgqbMnuZ0mJqoeREfjMMQHNEltxIet3/CdKjaTBquJqBi7W 7wJb8A3yb3B5b4OXS+CaAiIS/PaaqVW5FFjhNt+ha0IUXsqynq6b1yh2CPOAnXDArObp Vclg==; darn=lists.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=20230601; t=1769669076; x=1770273876; 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=WYAz/j+9fRnOHttjwrINFSMbPeMLyFoZkjOTXwJd+qY=; b=OUyEeI9puNWTaSfbGFSLeVRCgbayHUzmAIKjG5doZxS5GJm+QM/1htu6NKT+KrTrva m7om0yg53P8VJNjpfoEPb97oRWFm1pDPuC4DBLaAA4z5LqQ4c34FwvuHd7b56WM7RJBH /egQoIxqJXYIt/RED3dC7Se0W2RhYF3Y5aJeGfxvTypiZeWUsHX2KKQ5SbSYJ0+U2MP0 OPIcbBIXjHkR3kdHPaAIOXxH+whsBleCsYab8twwTMwnIulaLKELkP6hP/x0qo/9Rqk9 HIswkRk+R+36iRG9+C4MLvhZop2FsOYBF8AkzU4Xe/YwtTttnGqOLXC6DX89xi4CTguY hSlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769669076; x=1770273876; 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=WYAz/j+9fRnOHttjwrINFSMbPeMLyFoZkjOTXwJd+qY=; b=ERgD+6I7bHoTTn5cK6AlzJtVwr/smLu5aIchH1/AB34DzDuoTgBVmbV+pWfw7bIE0h 9P9ybzTPUPoKX1MJixhSQFVqvp9rY8KyGr1Q3xSPdCqz6bGpaGEeSZfe/kinc1yxwc+c 7dDSO/qAHtG0xHIPL6x7r+I133Mb6al78T3FFGtmw3/om4pyKD7X3L/F+Te5MM12U9vk ra1NQzDLQ7MWPBeiXmpSEaWBCKn0Lglyo3rN9UOZB1v0W3OnjuLtgdDAztCErjRsC2Fv cTAR56cJOIaSbtTacr84VOM1eh7hfVrzbGqw0Op4xfQpygZrDJhTd6as34TXtm1W3fz+ ZI+w== X-Forwarded-Encrypted: i=1; AJvYcCXinhofrZHapHiK83ysEX4WzUovR9HZsCWKGRhHeMDvv+y8iQ4PM7gF7TnhoDwaANX65hMdW01vVu9XUN3Z@lists.postgresql.org X-Gm-Message-State: AOJu0Yy7HuXF2Xdi1agjPZGjAhyoT2fX1JUZS0wK5w8UqRfxzEZj39uH W3Yt9fqn1o2FesQrnm31TuIKxDyUIvOupwfcaa9RUIM12EXrn06jMdKJckZPieaTE34dfpqejcJ IZysIvjuYpxuCHh37ukiKW8iqv7wcBRA= X-Gm-Gg: AZuq6aL3qJYCzG0IfzQPP9YOhYyWfwfgodBnCnCLGLaN79HONS6RNN7HwF+2Pl/e+zm IwTC/AsU3suzRgAaxg7M9Le4KR2nuYdVfQuUACP3U+jg6kzb0A/1V3jkMZy3M55KdXzXHOWBHbQ 1cK57KEp5mtELeBQIAhji+ujpNzDVFSolBJbl8i5d0y5CqIVN+3qhc1LKNfKaYB1oJBaoBYF8go BtuiauYN5bqz9mZVp8S++rLxaSmjrJPJ4U9UYvEs2wnTj+sPXS+oUPtnOOtnva/YSIffnhfdw== X-Received: by 2002:a05:6820:1625:b0:663:39:1744 with SMTP id 006d021491bc7-663003920camr1957956eaf.51.1769669075971; Wed, 28 Jan 2026 22:44:35 -0800 (PST) MIME-Version: 1.0 References: <1136161.1769654478@sss.pgh.pa.us> In-Reply-To: From: Richard Guo Date: Thu, 29 Jan 2026 15:44:24 +0900 X-Gm-Features: AZwV_QjXJ8rW-ni4kUuPGno-4UWwpNMHeAnj9avfN3LZva5B25cp_WjvSf_ekS4 Message-ID: Subject: Re: pg_plan_advice To: Lukas Fittl Cc: Tom Lane , Robert Haas , Jacob Champion , 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 Wed, Jan 28, 2026 at 6:41=E2=80=AFPM Tom Lane wrot= e: > > skink's not happy: > > > > =3D2162940=3D=3D VALGRINDERROR-BEGIN > > =3D=3D2162940=3D=3D Conditional jump or move depends on uninitialised v= alue(s) > > =3D=3D2162940=3D=3D at 0x434D366: cost_material (costsize.c:2593) > > =3D=3D2162940=3D=3D by 0x436E7E9: materialize_finished_plan (createp= lan.c:6531) > > =3D=3D2162940=3D=3D by 0x4383054: standard_planner (planner.c:533) > > ... > > =3D=3D2162940=3D=3D by 0x44CD09D: ProcessUtility (utility.c:525) > > =3D=3D2162940=3D=3D Uninitialised value was created by a stack allocat= ion > > =3D=3D2162940=3D=3D at 0x436E76A: materialize_finished_plan (createp= lan.c:6506) FWIW, the following related code in reparameterize_path() seems unsafe to me: spath =3D reparameterize_path(root, spath, required_outer, loop_count); enabled =3D (mpath->path.disabled_nodes <=3D spath->disabled_nodes); if (spath =3D=3D NULL) return NULL; return (Path *) create_material_path(rel, spath, enabled); I think we should access spath->disabled_nodes until after we have verified that spath is not NULL. Also, it's not quite clear to me why create_material_path (and cost_material) requires the "enabled" parameter. I couldn't find any comments on this, so it might be worth adding some comments here. - Richard