Re: SPI: process exit in SPI_exec when table not exist. error code not return.

From: Ian Lawrence Barwick <barwick(at)gmail(dot)com>
To: sasa su <i(at)sasa(dot)su>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: SPI: process exit in SPI_exec when table not exist. error code not return.
Date: 2021-02-05 02:55:10
Message-ID: CAB8KJ=j5Mr4MSyWeLOtfXjZmSiKFg6oPBbE85vAeux2DMFU=WA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2021年2月5日(金) 11:38 sasa su <i(at)sasa(dot)su>:

> Hi.
>
> When running a query with a not exist table in SPI_exec. the process exit
> with -1 in SPI_exec function.
> the error code SPI_ERROR_REL_NOT_FOUND never return.
>
> I made a minimal reproduction code in
> https://github.com/Sasasu/worker_spi_table_not_exist
>
> The core code is:
>
> int spi = SPI_exec("select * from not_exist_table", 0);
> // can not reach here
> Assert(spi == SPI_ERROR_REL_NOT_FOUND);
>

The list of return codes returned by SPI_exec is here:

https://www.postgresql.org/docs/current/spi-spi-execute.html

and doesn't include "SPI_ERROR_REL_NOT_FOUND". The only
function which does return that is SPI_unregister_relation, see:

https://www.postgresql.org/docs/current/spi-spi-unregister-relation.html

Regards

Ian Barwick

--
EnterpriseDB: https://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ian Lawrence Barwick 2021-02-05 02:57:17 Re: psql tab completion for CREATE DATABASE ... LOCALE
Previous Message Huang, Qiuyan 2021-02-05 02:54:32 RE: Determine parallel-safety of partition relations for Inserts