From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: stepya@ukr.net
Subject: BUG #18458: SQL Error [XX000]: ERROR: cache lookup failed for type 0
Date: Tue, 07 May 2024 09:47:34 +0000
Message-ID: <18458-61332181c54e5f5c@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 18458
Logged by: Stepan Yankevych
Email address: stepya@ukr.net
PostgreSQL version: 15.6
Operating system: CentOS Linux release 7.9.2009 (Core)
Description:
pg 15.6 / 15.3
Citus 12.1.1 / 12.1.3
autoexplain ON
test case
CREATE TABLE billing.test_table
( report_id int8 NULL,
date_id int4 NOT NULL);
SELECT create_distributed_table('test_table', 'report_id');
CREATE OR REPLACE PROCEDURE billing.test_delete_from(p_date_id int)
LANGUAGE plpgsql AS
$body$
BEGIN
DELETE FROM billing.test_table
WHERE date_id = p_date_id;
END;
$body$;
CALL billing.test_delete_from(20240401);
SQL Error [XX000]: ERROR: cache lookup failed for type 0
Where: SQL statement "DELETE FROM billing.test_table
WHERE date_id = p_date_id"
PL/pgSQL function test_delete_from(integer) line 3 at SQL statement
BUT if we use constant instead of parameter then everything works fine
CREATE OR REPLACE PROCEDURE billing.test_delete_from(p_date_id int)
LANGUAGE plpgsql AS
$body$
BEGIN
DELETE FROM billing.test_table
WHERE date_id = 20240401;
END;
$body$;
Also using Function instead of procedure works fine.
Disabling auto_explain resolves the issue.
So looks like a bug some incompatibility between Citus/autoexplain while
using delete inside procedure
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-bugs@postgresql.org
Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, stepya@ukr.net
Subject: Re: BUG #18458: SQL Error [XX000]: ERROR: cache lookup failed for type 0
In-Reply-To: <18458-61332181c54e5f5c@postgresql.org>
* 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