Re: plpgsql: variables of domain of composite types are not correctly initialized

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: plpgsql: variables of domain of composite types are not correctly initialized
Date: 2026-02-11 21:10:26
Message-ID: 13789.1770844226@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> writes:
> I got a bug report for plpgsql_check related to domains of composite types.
> While I played with code, maybe I found a bug:

Indeed. Looks like exec_stmt_return's special case for a simple
variable reference forgets to fill estate->rettype when the variable
is a null record. This is an old bug, but I think we'd managed not
to notice because that value isn't consulted unless we have to cast
to a domain.

The behavior we want is what exec_eval_datum does, and after looking
at it for a minute I wondered why we don't just use exec_eval_datum
instead of duplicating logic. The ROW case already does that, so
we can fix the bug with strictly less code.

regards, tom lane

Attachment Content-Type Size
fix-return-of-null-row.patch text/x-diff 1.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Paul A Jungwirth 2026-02-11 21:25:21 Re: SQL:2011 Application Time Update & Delete
Previous Message Matheus Alcantara 2026-02-11 21:07:46 Re: Add CREATE SCHEMA ... LIKE support