Re: ESQL/C no indicator variables ./. error -213

From: Matthias Apitz <guru(at)unixarea(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: ESQL/C no indicator variables ./. error -213
Date: 2020-06-18 07:13:55
Message-ID: 20200618071355.GA31656@sh4-5.1blu.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

El día Mittwoch, Juni 17, 2020 a las 01:39:53 -0400, Tom Lane escribió:

> Matthias Apitz <guru(at)unixarea(dot)de> writes:
> > We encountered that if our ESQL/C written servers see on SELECT or FETCH
> > in a row a NULL value, it will raise correctly the error -213 as written
> > and explained in https://www.postgresql.org/docs/11/ecpg-variables.html#ECPG-INDICATORS
> > We catch this error -213 and deal with in.
>
> > What we did not knew and discovered today is something very fatal: In
> > such a situation on a FETCH of a row of some 55 columns, the transfer of
> > the column elements into their hostvariables stops on first NULL value,
> > as here to be seen in the log:
>
> Could you provide a self-contained test case for this? It's hard to
> guess at what the problem might be.

Hello,

attached is a simple ESQL/C code; if it is not passing the mailing-list,
the code is also here: http://www.unixarea.de/embedded.pgc and this is
its output together with the ESQL/C error log file and SQL examples:

psql -Usisis -dsisis
psql (11.4)
Geben Sie »help« für Hilfe ein.

sisis=# \d dbctest
Tabelle »public.dbctest«
Spalte | Typ | Sortierfolge | NULL erlaubt? | Vorgabewert
-----------+---------------+--------------+---------------+-------------
tstchar25 | character(25) | | |
tstint | integer | | |
Indexe:
"i_tstint" UNIQUE, btree (tstint)

sisis=# select * from dbctest where tstint = 1;
tstchar25 | tstint
-----------+--------
| 1
(1 Zeile)

./embedded
hostvariable 'tstint' before SELECT tstchar25, tstint INTO :tstchar25, :tstint FROM dbctest: 99
hostvariable 'tstint' after SELECT tstchar25, tstint INTO :tstchar25, :tstint FROM dbctest with -213: 99

cat esqlc.6485
[6485] [18.06.2020 08:26:38:433]: ECPGdebug: set to 1
[6485] [18.06.2020 08:26:38:433]: ECPGdebug: proc argv0 is embedded
[6485] [18.06.2020 08:26:38:433]: ECPGconnect: opening database sisis on localhost port 5432 with options application_name=SunRise DBCALL V7.1 (pid=6485) for user sisis
[6485] [18.06.2020 08:26:38:436]: ecpg_execute on line 36: query: select tstchar25 , tstint from dbctest where tstint = 1; with 0 parameter(s) on connection sisis
[6485] [18.06.2020 08:26:38:437]: ecpg_execute on line 36: using PQexec
[6485] [18.06.2020 08:26:38:437]: ecpg_process_output on line 36: correctly got 1 tuples with 2 fields
[6485] [18.06.2020 08:26:38:437]: ecpg_get_data on line 36: RESULT: offset: 80; array: no
[6485] [18.06.2020 08:26:38:437]: raising sqlcode -213 on line 36: null value without indicator on line 36
[6485] [18.06.2020 08:26:38:438]: ecpg_finish: connection sisis closed

Thanks

matthias

--
Matthias Apitz, ✉ guru(at)unixarea(dot)de, http://www.unixarea.de/ +49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub
May, 9: Спаси́бо освободители! Thank you very much, Russian liberators!

Attachment Content-Type Size
embedded.pgc text/plain 1.1 KB

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sankar P 2020-06-18 07:46:43 Re: Importing a Large .ndjson file
Previous Message Tim Cross 2020-06-18 07:09:25 Re: Table partitioning with sequence field in postgresql12