Re: plpgsql: variables of domain of composite types are not correctly initialized
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Pavel Stehule <pavel.stehule@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2026-02-11T21:10:26Z
Lists: pgsql-hackers
Attachments
- fix-return-of-null-row.patch (text/x-diff) patch
Pavel Stehule <pavel.stehule@gmail.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
Commits
-
Fix plpgsql's handling of "return simple_record_variable".
- dfd850980304 17.9 landed
- ce4b7e3a1058 18.3 landed
- c66f4cff1a2e 16.13 landed
- 9863c90759ec 19 (unreleased) landed
- 2b93d382055b 14.22 landed
- 254b15cbf1e9 15.17 landed