1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

Fix the BY {REF,VALUE} clause of XMLEXISTS/XMLTABLE

This clause is used to indicate the passing mode of a XML document, but
we were doing it wrong: we accepted BY REF and ignored it, and rejected
BY VALUE as a syntax error.  The reality, however, is that documents are
always passed BY VALUE, so rejecting that clause was silly.  Change
things so that we accept BY VALUE.

BY REF continues to be accepted, and continues to be ignored.

Author: Chapman Flack
Reviewed-by: Pavel Stehule
Discussion: https://postgr.es/m/5C297BB7.9070509@anastigmatix.net
This commit is contained in:
Alvaro Herrera
2019-03-07 11:17:09 -03:00
parent cb706ec4b6
commit eaaa5986ad
3 changed files with 37 additions and 21 deletions

View File

@ -635,8 +635,8 @@ X204 XMLQuery: initializing an XQuery variable NO
X205 XMLQuery: EMPTY ON EMPTY option NO
X206 XMLQuery: NULL ON EMPTY option NO
X211 XML 1.1 support NO
X221 XML passing mechanism BY VALUE NO
X222 XML passing mechanism BY REF YES
X221 XML passing mechanism BY VALUE YES
X222 XML passing mechanism BY REF NO parser accepts BY REF but ignores it; passing is always BY VALUE
X231 XML(CONTENT(UNTYPED)) type NO
X232 XML(CONTENT(ANY)) type NO
X241 RETURNING CONTENT in XML publishing NO

View File

@ -13951,20 +13951,25 @@ xmlexists_argument:
{
$$ = $2;
}
| PASSING c_expr BY REF
| PASSING c_expr xml_passing_mech
{
$$ = $2;
}
| PASSING BY REF c_expr
| PASSING xml_passing_mech c_expr
{
$$ = $4;
$$ = $3;
}
| PASSING BY REF c_expr BY REF
| PASSING xml_passing_mech c_expr xml_passing_mech
{
$$ = $4;
$$ = $3;
}
;
xml_passing_mech:
BY REF
| BY VALUE_P
;
/*
* Aggregate decoration clauses