restoring user id and SecContext before logging error in ri_PlanCheck

From: Zhihong Yu <zyu(at)yugabyte(dot)com>
To: PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: restoring user id and SecContext before logging error in ri_PlanCheck
Date: 2022-11-02 14:04:37
Message-ID: CALNJ-vQJKNR45GZDRuu7xLFfBYVT2pY7ywYKMnu0qrvaC7uUow@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,
I was looking at the code in ri_PlanCheck
of src/backend/utils/adt/ri_triggers.c starting at line 2289.

When qplan is NULL, we log an error. This would skip
calling SetUserIdAndSecContext().

I think the intention of the code should be restoring user id
and SecContext regardless of the outcome from SPI_prepare().

If my understanding is correct, please take a look at the patch.

Thanks

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Zhihong Yu 2022-11-02 15:00:58 Re: restoring user id and SecContext before logging error in ri_PlanCheck
Previous Message Greg Stark 2022-11-02 13:54:54 Re: Temporary tables versus wraparound... again