postgres.git / summary / log / commit / refs

commit    8080f44f96a978ce94f7e6b44df1158880525e01
Author:   Peter Eisentraut <peter@eisentraut.org>
Date:     Tue Mar 10 12:56:52 2026 +0000

    Rename grammar nonterminal to simplify reuse
    
    A list of expressions with optional AS-labels is useful in a few
    different places.  Right now, this is available as xml_attribute_list
    because it was first used in the XMLATTRIBUTES construct, but it is
    already used elsewhere, and there are other possible future uses.  To
    reduce possible confusion going forward, rename it to
    labeled_expr_list (like existing expr_list plus ColLabel).
    
    Discussion: https://www.postgresql.org/message-id/flat/a855795d-e697-4fa5-8698-d20122126567@eisentraut.org


src/backend/parser/gram.y | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y index 9cbe8eafc45..19d8a29a35e 100644 --- a/src/backend/parser/gram.y +++ b/src/backend/parser/gram.y @@ -620,8 +620,8 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query); %type <str> opt_provider security_label -%type <target> xml_attribute_el -%type <list> xml_attribute_list xml_attributes +%type <target> labeled_expr +%type <list> labeled_expr_list xml_attributes %type <node> xml_root_version opt_xml_root_standalone %type <node> xmlexists_argument %type <ival> document_or_content @@ -16317,7 +16317,7 @@ func_expr_common_subexpr: COERCE_SQL_SYNTAX, @1); } - | XMLFOREST '(' xml_attribute_list ')' + | XMLFOREST '(' labeled_expr_list ')' { $$ = makeXmlExpr(IS_XMLFOREST, NULL, $3, NIL, @1); } @@ -16542,14 +16542,14 @@ opt_xml_root_standalone: ',' STANDALONE_P YES_P { $$ = makeIntConst(XML_STANDALONE_OMITTED, -1); } ; -xml_attributes: XMLATTRIBUTES '(' xml_attribute_list ')' { $$ = $3; } +xml_attributes: XMLATTRIBUTES '(' labeled_expr_list ')' { $$ = $3; } ; -xml_attribute_list: xml_attribute_el { $$ = list_make1($1); } - | xml_attribute_list ',' xml_attribute_el { $$ = lappend($1, $3); } +labeled_expr_list: labeled_expr { $$ = list_make1($1); } + | labeled_expr_list ',' labeled_expr { $$ = lappend($1, $3); } ; -xml_attribute_el: a_expr AS ColLabel +labeled_expr: a_expr AS ColLabel { $$ = makeNode(ResTarget); $$->name = $3; [parent: 0fbfd37cefb7]