Re: 2 questions about volatile attribute of pg_proc. - Mailing list pgsql-hackers

From David G. Johnston
Subject Re: 2 questions about volatile attribute of pg_proc.
Date
Msg-id CAKFQuwYHZDhoiTdx8X-wOVWzYcs9r6m7xD63dJww-U+OOjxrUQ@mail.gmail.com
Whole thread Raw
In response to Re: 2 questions about volatile attribute of pg_proc.  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Sun, Apr 18, 2021 at 9:08 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
Isaac Morland <isaac.morland@gmail.com> writes:
> On Sun, 18 Apr 2021 at 11:36, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Are you familiar with the halting problem?  I don't see any meaningful
>> difference here.

> I think what is being suggested is akin to type checking, not solving the
> halting problem.

Yeah, on further thought we'd be satisfied with a conservative
approximation, so that removes the theoretical-impossibility objection.
Still, there are a lot of remaining problems, as you note.


Yeah, the type checking approach seems blocked by the "black box" nature of functions.  A possibly more promising approach is for the top-level call to declare its expectations (which are set by the user) and during execution if that expectation is violated directly, or is reported as violated deeper in the call stack, the execution of the function fails with some kind of invalid state error.  However, as with other suggestions of this nature, the fundamental blocker here is that to be particularly useful this kind of validation needs to happen by default (as opposed to opt-in) which risks breaking existing code.  And so I foresee this request falling into the same category as those others - an interesting idea that could probably be made to work but by itself isn't worthwhile enough to go and introduce a fundamental change to the amount of "parental oversight" PostgreSQL tries to provide.

David J.

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: 2 questions about volatile attribute of pg_proc.
Next
From: Yulin PEI
Date:
Subject: 回复: Core dump happens when execute sql CREATE VIEW v1(c1) AS (SELECT ('4' COLLATE "C")::INT FROM generate_series(1, 10));