Re: SQLFunctionCache and generic plans - Mailing list pgsql-hackers

From Alexander Lakhin
Subject Re: SQLFunctionCache and generic plans
Date
Msg-id 94b13098-8c2c-4b1a-87e3-579e27d17509@gmail.com
Whole thread Raw
In response to Re: SQLFunctionCache and generic plans  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: SQLFunctionCache and generic plans
List pgsql-hackers
05.04.2025 00:47, Tom Lane wrote:
Alexander Lakhin <exclusion@gmail.com> writes:
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);
Hmm, I see

regression=# CREATE FUNCTION f(VARIADIC ANYARRAY) RETURNS ANYELEMENT AS $$ SELECT x FROM generate_series(1,1) g(i) $$ LANGUAGE SQL IMMUTABLE;
CREATE FUNCTION
regression=# SELECT f(1);
ERROR:  column "x" does not exist
LINE 1:  SELECT x FROM generate_series(1,1) g(i)                 ^
QUERY:   SELECT x FROM generate_series(1,1) g(i) 
CONTEXT:  SQL function "f" statement 1
regression=# SELECT f(1);
ERROR:  unrecognized node type: 2139062143
CONTEXT:  SQL function "f" statement 1

Did you intend the typo?  The "unrecognized node type" does indicate
a problem, but your message doesn't seem to indicate that you're
expecting a syntax error.


Yes, the typo is intended. With Valgrind, I get the "column does not exist"
error on the first call and the Valgrind complaint on the second one.

Best regards,
Alexander Lakhin
Neon (https://neon.tech)

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: SQLFunctionCache and generic plans
Next
From: Matthew Sterrett
Date:
Subject: Proposal for enabling auto-vectorization for checksum calculations