Postgres XMLTABLE with missing nodes

246 Views Asked by At

Assume Table A with an XML field. Table A has two rows, with the following XML data in the table.

Row 1

<fullname>
  <firstName>John</firstName>
  <lastName>Smith</lastName>
</fullname>

and Row 2

<fullname>
  <firstName>Jane</firstName>
</fullname>

This query:

SELECT * FROM A 
  XMLTABLE(('/fullname'::text) PASSING (a.xml) 
  COLUMNS firstName text PATH ('firstName'::text), lastName text PATH ('lastName'::text)) a

will only return data on John and not Jane. Is there a work around for this?

1

There are 1 best solutions below

1
On