Re: Checking return value of SPI_execute

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Mark Dilger <hornschnorter(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Checking return value of SPI_execute
Date: 2019-11-07 02:13:56
Message-ID: 20191107021356.GC1768@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2019-11-07 02:24:37 Re: RFC: split OBJS lines to one object per line
Previous Message Amit Langote 2019-11-07 01:58:51 Re: [PATCH] Do not use StdRdOptions in Access Methods