Skip to content
Snippets Groups Projects
  • Tom Lane's avatar
    0ce7676a
    Make xpath() do something useful with XPath expressions that return scalars. · 0ce7676a
    Tom Lane authored
    Previously, xpath() simply returned an empty array if the expression did
    not yield a node set.  This is useless for expressions that return scalars,
    such as one with name() at the top level.  Arrange to return the scalar
    value as a single-element xml array, instead.  (String values will be
    suitably escaped.)
    
    This change will also cause xpath_exists() to return true, not false,
    for such expressions.
    
    Florian Pflug, reviewed by Radoslaw Smogura
    0ce7676a
    History
    Make xpath() do something useful with XPath expressions that return scalars.
    Tom Lane authored
    Previously, xpath() simply returned an empty array if the expression did
    not yield a node set.  This is useless for expressions that return scalars,
    such as one with name() at the top level.  Arrange to return the scalar
    value as a single-element xml array, instead.  (String values will be
    suitably escaped.)
    
    This change will also cause xpath_exists() to return true, not false,
    for such expressions.
    
    Florian Pflug, reviewed by Radoslaw Smogura