Re: Checking return value of SPI_execute

2019-11-07 Thread Alvaro Herrera
On 2019-Nov-07, Mark Dilger wrote: > I'd like to keep the status codes for (a) but deprecate error codes for (b) > in favor of elog(ERROR). I don't see that these elogs should ever be a > problem, since getting one in testing would indicate the need to fix bad C > code, not the need to catch an

Re: Checking return value of SPI_execute

2019-11-07 Thread Mark Dilger
On 11/6/19 7:11 AM, Alvaro Herrera wrote: On 2019-Nov-06, Pavel Stehule wrote: My comment was about maybe obsolescence of this API. Probably it was designed before exception introduction. For example - syntax error is ended by exception. Wrong numbers of argument is signalized by error

Re: Checking return value of SPI_execute

2019-11-06 Thread Michael Paquier
On Wed, Nov 06, 2019 at 07:35:18AM -0800, Mark Dilger wrote: > Other code that checks the return value from an SPI function is inconsistent > about whether it checks for SPI_OK_SELECT or simply checks for a negative > result. I was on the fence about which precedent to follow, and was just >

Re: Checking return value of SPI_execute

2019-11-06 Thread Pavel Stehule
st 6. 11. 2019 v 16:38 odesílatel Mark Dilger napsal: > > > On 11/5/19 9:54 PM, Pavel Stehule wrote: > > > > > > st 6. 11. 2019 v 5:28 odesílatel Michael Paquier > > napsal: > > > > On Tue, Nov 05, 2019 at 05:21:25PM -0800, Mark Dilger wrote: > > > please

Re: Checking return value of SPI_execute

2019-11-06 Thread Mark Dilger
On 11/5/19 9:54 PM, Pavel Stehule wrote: st 6. 11. 2019 v 5:28 odesílatel Michael Paquier > napsal: On Tue, Nov 05, 2019 at 05:21:25PM -0800, Mark Dilger wrote: > please find attached a patch fixing a problem previously discussed [1] about >

Re: Checking return value of SPI_execute

2019-11-06 Thread Mark Dilger
On 11/5/19 8:27 PM, Michael Paquier wrote: On Tue, Nov 05, 2019 at 05:21:25PM -0800, Mark Dilger wrote: please find attached a patch fixing a problem previously discussed [1] about the code inappropriately ignoring the return value from SPI_execute. I will be adding this to

Re: Checking return value of SPI_execute

2019-11-06 Thread Alvaro Herrera
On 2019-Nov-06, Pavel Stehule wrote: > My comment was about maybe obsolescence of this API. Probably it was > designed before exception introduction. > > For example - syntax error is ended by exception. Wrong numbers of argument > is signalized by error status. I didn't study this code, but

Re: Checking return value of SPI_execute

2019-11-06 Thread Pavel Stehule
st 6. 11. 2019 v 8:56 odesílatel Michael Paquier napsal: > On Wed, Nov 06, 2019 at 06:54:16AM +0100, Pavel Stehule wrote: > > Is generic question if this exception should not be raised somewhere in > > spi.c - maybe at SPI_execute. > > > > When you look to SPI_execute_plan, then checked errors

Re: Checking return value of SPI_execute

2019-11-05 Thread Michael Paquier
On Wed, Nov 06, 2019 at 06:54:16AM +0100, Pavel Stehule wrote: > Is generic question if this exception should not be raised somewhere in > spi.c - maybe at SPI_execute. > > When you look to SPI_execute_plan, then checked errors has a character +/- > assertions. All SQL errors are ended by a

Re: Checking return value of SPI_execute

2019-11-05 Thread Pavel Stehule
st 6. 11. 2019 v 5:28 odesílatel Michael Paquier napsal: > On Tue, Nov 05, 2019 at 05:21:25PM -0800, Mark Dilger wrote: > > please find attached a patch fixing a problem previously discussed [1] > about > > the code inappropriately ignoring the return value from SPI_execute. > > > > I will be

Re: Checking return value of SPI_execute

2019-11-05 Thread Michael Paquier
On Tue, Nov 05, 2019 at 05:21:25PM -0800, Mark Dilger wrote: > please find attached a patch fixing a problem previously discussed [1] about > the code inappropriately ignoring the return value from SPI_execute. > > I will be adding this to https://commitfest.postgresql.org/26/ > shortly. Yes,

Checking return value of SPI_execute

2019-11-05 Thread Mark Dilger
/24753.1558141935%40sss.pgh.pa.us >From 5c4013e41fbe212e41116509c54a032e1b9ebc0d Mon Sep 17 00:00:00 2001 From: Mark Dilger Date: Tue, 5 Nov 2019 16:40:58 -0800 Subject: [PATCH v1] Checking return value of SPI_execute. In query_to_oid_list, the return code from SPI_execute was ignored. I know of no c