Re: document and use SPI_result_code_string()

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: document and use SPI_result_code_string()
Date: 2017-09-06 07:40:21
Message-ID: CAB7nPqQn16kR=Zsh-nC-oAyeKkv9KgP7zSDuwEfr94n_5MgC0Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Aug 31, 2017 at 11:23 AM, Peter Eisentraut
<peter(dot)eisentraut(at)2ndquadrant(dot)com> wrote:
> A lot of semi-internal code just prints out numeric SPI error codes,
> which is not very helpful. We already have an API function
> SPI_result_code_string() to convert the codes to a string, so here is a
> patch to make more use of that and also document it for external use.
>
> Also included are two patches to clarify that some RI error handling
> code that I encountered at the same time.

Those are simple things. Agreed for 0001 to untangle things.

Fine for 0002. This reminds me of LockGXact and RemoveGXact in
twophase.c, as well as _hash_squeezebucket that have some code paths
that cannot return... Any thoughts about having some kind of
PG_NOTREACHED defined to 0 which could be put in an assertion?

+1 for 0003. There are other undocumented functions available to users:
- SPI_plan_is_valid
- SPI_execute_snapshot
- SPI_plan_get_plan_sources
- SPI_plan_get_cached_plan
- SPI_datumTransfer
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Meskes 2017-09-06 07:41:59 Re: 【ECPG】strncpy function does not set the end character '\0'
Previous Message Rushabh Lathia 2017-09-06 07:36:06 Re: dropping partitioned tables without CASCADE