From: Tom Lane <tgl@sss.pgh.pa.us>
To: Garfield Lewis <garfield.lewis@lzlabs.com>
Cc: PostgreSQL mailing lists <pgsql-general@postgresql.org>
Subject: Re: Passing XML column in an array
Date: Thu, 10 Feb 2022 12:53:27 -0500
Message-ID: <1693386.1644515607@sss.pgh.pa.us> (raw)
In-Reply-To: <247353C7-F577-46D7-9EB6-FA4CB8452D5F@lzlabs.com>
References: <247353C7-F577-46D7-9EB6-FA4CB8452D5F@lzlabs.com>
Garfield Lewis <garfield.lewis@lzlabs.com> writes:
> I am trying to pass an array into a new function I am creating called lzxmlexists via the following statement:
> wdbs=# SELECT "XT"."ROWKEY" , "XT"."XMLT1C1" FROM "LZQAAS"."T642_XML_T1" "XT" WHERE "ROWKEY"=64201 AND lzxmlexists( ' $XTX//DeptName[ . = $Dn ]', 'DEFAULT', ARRAY["XT"."XMLT1C1"] ) ORDER BY "ROWKEY";
> The column XT.XMLT1C1 exists because I can do a simple select to see the contents. The problem is that in the code above I hit the following error at line 161.
> 160 for ( size_t ix = 0; ix < iXmlCount; ++ix ) {
> (gdb)
> 163 xmltype *pX = DatumGetXmlP( pXmlData[ix] );
> (gdb)
> Program received signal SIGSEGV, Segmentation fault.
> 0x00000000008b3514 in pg_detoast_datum ()
The most obvious theory is that there are some nulls in the XT.XMLT1C1
column. Since your code isn't bothering to check pXmlDataNulls[ix],
it would hit a null-pointer dereference when accessing pXmlData[ix].
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, garfield.lewis@lzlabs.com
Subject: Re: Passing XML column in an array
In-Reply-To: <1693386.1644515607@sss.pgh.pa.us>
References: <247353C7-F577-46D7-9EB6-FA4CB8452D5F@lzlabs.com> <1693386.1644515607@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox