Re: has_table_privilege for a table in unprivileged schema causes an error - Mailing list pgsql-hackers

From David G. Johnston
Subject Re: has_table_privilege for a table in unprivileged schema causes an error
Date
Msg-id CAKFQuwYtcpYMhuno29gi7-AFujFLo0OGJAJByPfr87qvmH5LTg@mail.gmail.com
Whole thread Raw
In response to Re: has_table_privilege for a table in unprivileged schema causes an error  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: has_table_privilege for a table in unprivileged schema causes an error
List pgsql-hackers
On Sat, Aug 25, 2018 at 8:29 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
There's a backwards-compatibility argument for not changing this behavior,
sure, but I don't buy the other arguments you made here.  And I don't
think there's all that much to the backwards-compatibility argument,
considering that the current behavior is to fail.

+1; any code using these functions can reasonably be expected to handle true and false responses.  Converting a present error into a false under that presumption results in similar, and arguably improved, semantics.

While null is something to be avoided generally this is one of those cases where if we did want to have a "cannot answer the question because pre-conditions are not met" response I'd strongly consider using null to represent that response instead of an error - using coalesce is considerably easier than performing error handling.  That isn't an option here and the while there is information loss involved in the proposed change its seems worth it to me to make such a change to make using the function for its primary behavior easier at the cost of a removing a hard-to-use side effect.  Adding a new default argument or function is not desirable.

To be clear, I do not consider this is not a backpatchable change.

David J.

pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: simplify index tuple descriptor initialization
Next
From: Peter Eisentraut
Date:
Subject: Re: some more error location support