Re: Checking return value of SPI_execute - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Checking return value of SPI_execute
Date
Msg-id 20191107021356.GC1768@paquier.xyz
Whole thread Raw
In response to Re: Checking return value of SPI_execute  (Mark Dilger <hornschnorter@gmail.com>)
List pgsql-hackers
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
> slightly in favor of testing for negative rather than SPI_OK_SELECT due to
> this function, query_to_oid_list, taking the query string as an argument and
> not controlling whether that argument is indeed a plain SELECT.
>
> I don't feel strongly about it.

The code relies on SELECT queries now to fetch a list of relation
OIDs and it is read-only.  If it happens that another query type makes
sense for this code path, then the person using the routine will need
to think about what to do when seeing the new error.  The current code
exists for ages, so I have applied your change only on HEAD.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Amit Langote
Date:
Subject: Re: [PATCH] Do not use StdRdOptions in Access Methods
Next
From: Michael Paquier
Date:
Subject: Re: RFC: split OBJS lines to one object per line