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

From: sasa su <i(at)sasa(dot)su>
To: Ian Lawrence Barwick <barwick(at)gmail(dot)com>
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 03:15:07
Message-ID: 300181612494551@mail.yandex.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

<div>Thanks barwick,</div><div> </div><div><div>Is the process crash also expected,</div><div> </div><div><div>And dose anyone considered enhancing this API?</div></div></div><div> </div><div>05.02.2021, 10:55, "Ian Lawrence Barwick" &lt;barwick(at)gmail(dot)com&gt;:</div><blockquote><div><div><div>2021年2月5日(金) 11:38 sasa su &lt;<a href="mailto:i(at)sasa(dot)su" rel="noopener noreferrer">i(at)sasa(dot)su</a>&gt;:</div><blockquote style="border-left-color:rgb( 204 , 204 , 204 );border-left-style:solid;border-left-width:1px;margin:0px 0px 0px 0.8ex;padding-left:1ex"><div>Hi.</div><div> </div><div>When running a query with a not exist table in SPI_exec. the process exit with -1 in SPI_exec function.</div><div>the error code SPI_ERROR_REL_NOT_FOUND never return.</div><div> </div><div>I made a minimal reproduction code in <a href="https://github.com/Sasasu/worker_spi_table_not_exist" rel="noopener noreferrer" target="_blank">https://github.com/Sasasu/worker_spi_table_not_exist</a></div><div> </div><div>The core code is:</div><div> </div><div><div>   int spi = SPI_exec("select * from not_exist_table", 0);</div><div>   // can not reach here<br />   Assert(spi == SPI_ERROR_REL_NOT_FOUND);</div></div></blockquote><div> </div><div> </div><div>The list of return codes returned by SPI_exec is here:</div><div> </div><div>   <a href="https://www.postgresql.org/docs/current/spi-spi-execute.html" rel="noopener noreferrer">https://www.postgresql.org/docs/current/spi-spi-execute.html</a></div><div> </div><div>and doesn't include "SPI_ERROR_REL_NOT_FOUND". The only</div><div>function which does return that is SPI_unregister_relation, see:</div><div> </div><div>  <a href="https://www.postgresql.org/docs/current/spi-spi-unregister-relation.html" rel="noopener noreferrer">https://www.postgresql.org/docs/current/spi-spi-unregister-relation.html</a></div><div> </div><div> </div><div>Regards</div><div> </div><div>Ian Barwick</div></div><br /><br />--<div><div>EnterpriseDB: <a href="https://www.enterprisedb.com/" rel="noopener noreferrer" target="_blank">https://www.enterprisedb.com</a><div> </div></div></div></div></blockquote>

Attachment Content-Type Size
unknown_filename text/html 2.1 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Hou, Zhijie 2021-02-05 03:58:24 RE: Parallel INSERT (INTO ... SELECT ...)
Previous Message Amit Langote 2021-02-05 03:14:27 Re: making update/delete of inheritance trees scale better