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 1wXFQw-0039ZA-1X for pgsql-bugs@arkaria.postgresql.org; Wed, 10 Jun 2026 09:41:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wXFQv-00ATxO-18 for pgsql-bugs@arkaria.postgresql.org; Wed, 10 Jun 2026 09:41:13 +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 1wXFQv-00ATxG-0M for pgsql-bugs@lists.postgresql.org; Wed, 10 Jun 2026 09:41:13 +0000 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wXFQt-00000002J7u-0ZW5 for pgsql-bugs@lists.postgresql.org; Wed, 10 Jun 2026 09:41:12 +0000 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-2c0c1e0b0faso45090365ad.0 for ; Wed, 10 Jun 2026 02:41:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1781084469; cv=none; d=google.com; s=arc-20240605; b=G/ueoEEkgtRD8YHbHeRXYBmblsmB0jG8JRGpMkR+iU84Ag+BxzVp6nZq7gTQwJpu5h sFFqz9Dwb9NN4hy/JNejLwsKy4xUjjO5C1mn5p7F/H9h0YjdFGc6b7h5x7lSYxiW5bAu YW7ImfVo1BqernPjk4pSvvWuoGK5DA9nCo4HPqWKh01bnEroacyMHw84KxGwE2ePasqG qFyUjRTSclK3uqMqVNWFwRPuZ6fk+5nDHUsPP2oLFmtFgu26TnQ/9kiIVvfGuZ7kOPCb LbnFkj/Gwi/3cqdWg8ORg7t1ta7J5VJ4qo6FTsuu7MfPADXfFNjnAh19nf+icklljmNg Bwsw== 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=1FKAx0MDTa1MeQJuuptkByxqW1MaoKU41/TNbqKROJ8=; fh=0wqje5zGlmCUi+jvR8X9KyO1k89Nzoet5/CgMzx4J7k=; b=YBK+CiQ599KzEhErwR0e7qYHNsDjeRyRlwj0r8igBRFNN0rSq3iFgsWSvNJwCpiSIK 55sInEj1GBZHHBnDJaPVZPaobohsAntnRVx+IN0Y04py5W8btuIIhh6QkLx5374+FU24 G+JY1i2WVGLD1lXZ8k+Jgzsvxv8ILMA734dolpIHXMYU6IHXC6l9Bgwn4nyvTdwQi9Xk l93R4mjcuECbXRe7LgjVU2bcn79B4w1zUK2dtmbs9DR9qSbk0aEWCgwB4F7+AxMoLGSm RKZ+1NvNbTUpNFxAavNDhFH0r5SLHVkRVPOs9fpHJx/tw0av9NbEJ5vr79Y8U4Fd3Dv3 Gozg==; 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=20251104; t=1781084469; x=1781689269; 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=1FKAx0MDTa1MeQJuuptkByxqW1MaoKU41/TNbqKROJ8=; b=RFSA76z4Xhp0bZwOpMlRAW7N/W17Vr90i4i1lsSUeQOWu9FHDpKJX9kU5RuCbPA63N Tnhwi3MJJR7tOqG3TXUi4XCqVIf1TyN4pEG5bTUugAHo02bJL2V9ZqYHyQ6tbzfeSoK8 SzfAwftDigO+OHqsvdRiL8WOMvZ//CCtniT2MVkzYrJ41nduYItcz6YqbDFhMmtT5NZY AueYqV+bXeqmwzW5XPn4sTpknKOQgO3JnViMVL4tfVojVIzfuf4p8oKdwLM99wccg5Tj 8W+QGLyMXrMuzTV6o8ZYGyhVnoo+KmozEXR5DOQ4pXGK8v+PDD5zGHitMsSx72KwVigQ F7rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781084469; x=1781689269; 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=1FKAx0MDTa1MeQJuuptkByxqW1MaoKU41/TNbqKROJ8=; b=QpztMayjVkoUPqI3hw0Waf5kkeu6Q4jhICMoICj9AKDMURJ6wA4nplpY7kbW+dMW9G bPg/TeSM5kH/vgRE8XslT0H/39YL31GPgzmCFJjPVvPrNxP8mjVpk16QRdOJgg4MTJuF /FEJg2ZtVSiuUyn+DXkRHsmIVnXzhA7I79mizFGehTRhdAWpv6T1ky8Z8x3jmil9+xuY bkG4P1xdbvjfPOkwiy5l+l2zQeF8SOBcGh9Lhk0yKo+JjpWsMDnx0GDNpQ87RqYODfae 3nquwGEUBOZ01ydagt/jcSfgOjTkff+VYiYJQJO8eXencKBCem5WqZu7IGzrYrU5GAaI GH0A== X-Forwarded-Encrypted: i=1; AFNElJ9a+Fh3xD2B9tUq1ziUBjvgAj49E/3nEUxtwO3IdIOIiclRlQM7w12ryUhRVpbNkzTmlkMt+TTbZ3La@lists.postgresql.org X-Gm-Message-State: AOJu0Yy82kQdGdSTk+lUAJPHHH2jcmkD+Tz6LMHHPgq64TW+T48EratX 1iP02SXQb2qdhO1eBXUBAp+YlOjTLTJX9sKwFLpMjZxjJKQokow8m3RThiBcpJMj1JnAdaUNVZK L7OJ9+8PJ8Nw+/QeXTnlZY9cROY9+U8E= X-Gm-Gg: Acq92OFTkrQ1H8E8ME3dmvr+G6A8UQsn8AuhFxbZGG7/Ltj6hNgZ8q8hbrm4Lo025Fb OFOgy9HT25tCa5RcboYqGpZAKgG4HSEyC55Ezv2V7WqtwjiofxodElb9Ap9QzFqZ5YDxvtCexL+ JhMwQgNtZdz6hUJ6wzs9t9hTomOMy2XWGAo3KyjbErWxadLmrSb+G4mP5bP59fZCRHTYdCZpF2D tlJbWqZ5Jk1Y14ap51xIod1dUpwpusdSUC100L3XXpZ6ovoKBddCEfBYpbUjEB55aURCk2wyvkT uR4xHFHZl6V8LMS8Vwb7+kiiOln1mntVKdzx3tj+KvoseI2VmZG3aGSHgt27v3zU3asmX3D9Nk0 = X-Received: by 2002:a17:903:2987:b0:2c1:88a1:9830 with SMTP id d9443c01a7336-2c1e7e74ecamr288055345ad.17.1781084468749; Wed, 10 Jun 2026 02:41:08 -0700 (PDT) MIME-Version: 1.0 References: <19470-0a344a5b356fc1a8@postgresql.org> <95eeb76a-74eb-46f8-a579-c1aefdad8d8f@app.fastmail.com> In-Reply-To: <95eeb76a-74eb-46f8-a579-c1aefdad8d8f@app.fastmail.com> From: Amit Langote Date: Wed, 10 Jun 2026 18:40:52 +0900 X-Gm-Features: AVVi8CdFUBq-rqZcZ0Tum974gDzFHgQjxmqSzFOnjp1oOvDNYIzyMllnfLuiGU8 Message-ID: Subject: Re: BUG #19470: PostgreSQL backend aborts (assert failure) when a prepared statement returns a composite type cast t To: Euler Taveira Cc: haogangmao@gmail.com, pgsql-bugs@lists.postgresql.org 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 Hi, On Tue, May 5, 2026 at 11:37=E2=80=AFAM Euler Taveira w= rote: > On Wed, Apr 29, 2026, at 8:27 AM, PG Bug reporting form wrote: > > > > Reproduction steps (minimal): > > BEGIN; > > CREATE TYPE foo AS (a int, b text); > > PREPARE p AS SELECT CAST(ROW(1, 'hello') AS foo)::text; > > EXECUTE p; > > ALTER TYPE foo ALTER ATTRIBUTE a TYPE VARCHAR(100); > > EXECUTE p; > > COMMIT; > > > > Thanks for your report! The attached patch fixes this case. I included a > similar test case but I'm fine if the test is not included with this fix.= I > decided to create a separate function instead of adding the new condition= s to > record_plan_type_dependency() because it keeps the fix simple and isolate= d. > > The crash is reproduced back to v11 which means this fix should be backpa= tched > to all supported versions. Thanks for working on this. I think this is on the right track. Using relationOids is the right mechanism, since the DDL doesn't touch the composite's pg_type row and a TYPEOID inval item wouldn't work here. Doing it in fix_expr_common covers extract_query_dependencies too. What I'm less easy about is whether Const and RowExpr are the only carriers. As written, the TYPTYPE_COMPOSITE test won't look through an array over a composite or a domain over one, and nodes like FieldSelect and ConvertRowtypeExpr also carry composite type OIDs. Could you check whether any of those reproduce a similar crash? If so we'd want to look through to the element/base type and/or cover more node types before this goes in. Modulo that, I'll prepare to push to all supported branches. --=20 Thanks, Amit Langote