pg.ddx.io pgsql-hackers@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Alexander Lakhin <exclusion@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Alexander Pyhalov <a.pyhalov@postgrespro.ru>
Cc: Pavel Stehule <pavel.stehule@gmail.com>
Cc: Alexander Korotkov <aekorotkov@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org, Ronan Dunklau <ronan.dunklau@aiven.io>
Subject: Re: SQLFunctionCache and generic plans
Date: Fri, 4 Apr 2025 22:00:01 +0300
Message-ID: <6d442183-102c-498a-81d1-eeeb086cdc5a@gmail.com> (raw )
In-Reply-To: <1454289.1743707630@sss.pgh.pa.us >
References: <8216639.NyiUUSuA9g@aivenlaptop >
<CAFj8pRC_4gEfmDoB5KbacNDdt3e6Tnf1z1BFK=MVp3+2kcDVqw@mail.gmail.com >
<CAFj8pRA7MFTfUPwDDWtghaUvAjbrMHFUPbHyLSX3h8+FDw4WFg@mail.gmail.com >
<445556.1738612687@sss.pgh.pa.us >
<464677.1738620525@sss.pgh.pa.us >
<1fc18af56d5fb27bf3e153ffaa2ed70d@postgrespro.ru >
<2615770.1740688857@sss.pgh.pa.us >
<448c63cf9b4f917c01802309b9c29eb9@postgrespro.ru >
<CAFj8pRDWDeF2cC+pCjLHJno7KnK5kdtjYN-f933R! ! ! ! ! HS7UneArFw@mail.gmail.com >
<CAFj8pRD0diy5VDP=8B9au5sk_yRknCWqZx35VniBtP_OA4aJNw@mail.gmail.com >
<2827970.1741890560@sss.pgh.pa.us >
<337e011069b6831e063bfa346f49bb46@postgrespro.ru >
<3344719.1741985546@sss.pgh.pa.us >
<fcc68b0ef570160cd6e88851eb244ccd@postgrespro.ru >
<db42573039cc66815e80a48589eebea8@postgrespro.ru >
<2691107.1743257329@sss.pgh.pa.us >
<3605427.1743351017@sss.pgh.pa.us >
<248291.1743463745@sss.pgh.pa.us >
<1101294.1743617356@sss.pgh.! pa.us >
<0fde377a-3870-4d18-946a-ce008ee5bb88@gmail.com >
<1454289.1743707630@sss.pgh.pa.us >
Hello Tom,
03.04.2025 22:13, Tom Lane wrpte:
> Drat. I thought I'd tested the empty-function-body case, but
> evidently that was a few changes too far back. Will fix,
> thanks for catching it.
I've stumbled upon another defect introduced with 0dca5d68d:
CREATE FUNCTION f(VARIADIC ANYARRAY) RETURNS ANYELEMENT AS $$ SELECT x FROM generate_series(1,1) g(i) $$ LANGUAGE SQL
IMMUTABLE;
SELECT f(1);
SELECT f(1);
fails under Valgrind with:
2025-04-04 18:31:13.771 UTC [242811] LOG: statement: SELECT f(1);
==00:00:00:19.324 242811== Invalid read of size 4
==00:00:00:19.324 242811== at 0x48D610: copyObjectImpl (copyfuncs.c:187)
==00:00:00:19.324 242811== by 0x490194: _copyAlias (copyfuncs.funcs.c:48)
==00:00:00:19.324 242811== by 0x48D636: copyObjectImpl (copyfuncs.switch.c:19)
==00:00:00:19.324 242811== by 0x491CBF: _copyRangeFunction (copyfuncs.funcs.c:1279)
==00:00:00:19.324 242811== by 0x48DC9C: copyObjectImpl (copyfuncs.switch.c:271)
==00:00:00:19.324 242811== by 0x4A295C: list_copy_deep (list.c:1652)
==00:00:00:19.324 242811== by 0x4900FA: copyObjectImpl (copyfuncs.c:192)
==00:00:00:19.324 242811== by 0x4931E4: _copySelectStmt (copyfuncs.funcs.c:2109)
==00:00:00:19.324 242811== by 0x48E00C: copyObjectImpl (copyfuncs.switch.c:436)
==00:00:00:19.324 242811== by 0x492F85: _copyRawStmt (copyfuncs.funcs.c:2026)
==00:00:00:19.324 242811== by 0x48DFBC: copyObjectImpl (copyfuncs.switch.c:421)
==00:00:00:19.324 242811== by 0x76DCCE: CreateCachedPlan (plancache.c:213)
==00:00:00:19.324 242811== Address 0x11b478d0 is 4,032 bytes inside a block of size 8,192 alloc'd
==00:00:00:19.324 242811== at 0x4846828: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==00:00:00:19.324 242811== by 0x7AA15D: AllocSetContextCreateInternal (aset.c:444)
==00:00:00:19.324 242811== by 0x43CF56: init_sql_fcache (functions.c:616)
==00:00:00:19.324 242811== by 0x43CF56: fmgr_sql (functions.c:1484)
==00:00:00:19.324 242811== by 0x423E13: ExecInterpExpr (execExprInterp.c:926)
==00:00:00:19.324 242811== by 0x41EB54: ExecInterpExprStillValid (execExprInterp.c:2299)
...
Best regards,
Alexander Lakhin
Neon (https://neon.tech )
view thread (49+ messages) latest in thread
Message-ID: <6d442183-102c-498a-81d1-eeeb086cdc5a@gmail.com>
Permalink: ../6d442183-102c-498a-81d1-eeeb086cdc5a@gmail.com/
Also on: postgresql.org/message-id/6d442183-102c-498a-81d1-eeeb086cdc5a@gmail.com
copy link · copy postgr.es
reply Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: exclusion@gmail.com, tgl@sss.pgh.pa.us, a.pyhalov@postgrespro.ru, pavel.stehule@gmail.com, aekorotkov@gmail.com, ronan.dunklau@aiven.io
Subject: Re: SQLFunctionCache and generic plans
In-Reply-To: <6d442183-102c-498a-81d1-eeeb086cdc5a@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox