Deparse named arguments to use the new => operator instead of :=
authorRobert Haas <rhaas@postgresql.org>
Fri, 1 May 2015 13:37:10 +0000 (09:37 -0400)
committerRobert Haas <rhaas@postgresql.org>
Fri, 1 May 2015 13:37:10 +0000 (09:37 -0400)
Tom Lane pointed out that this wasn't done, and asked whether that was
intentional.  Subsequent discussion was in favor of making the change,
so here we go.

src/backend/parser/parse_func.c
src/backend/utils/adt/ruleutils.c
src/test/regress/expected/polymorphism.out

index 1385776f6bd9cf73747fcea78ed97e487b6624d5..f7affebf84e55f16997659d361c20070623a9b6a 100644 (file)
@@ -1860,7 +1860,7 @@ funcname_signature_string(const char *funcname, int nargs,
            appendStringInfoString(&argbuf, ", ");
        if (i >= numposargs)
        {
-           appendStringInfo(&argbuf, "%s := ", (char *) lfirst(lc));
+           appendStringInfo(&argbuf, "%s => ", (char *) lfirst(lc));
            lc = lnext(lc);
        }
        appendStringInfoString(&argbuf, format_type_be(argtypes[i]));
index 29d1210e05cb71e63afb5c984c4620e206ba251f..fea8db6a5333fe5e31268dd9cfee96bde18296f3 100644 (file)
@@ -6856,7 +6856,7 @@ get_rule_expr(Node *node, deparse_context *context,
            {
                NamedArgExpr *na = (NamedArgExpr *) node;
 
-               appendStringInfo(buf, "%s := ", quote_identifier(na->name));
+               appendStringInfo(buf, "%s => ", quote_identifier(na->name));
                get_rule_expr((Node *) na->arg, context, showimplicit);
            }
            break;
index 987b3eed7d3608406e89c3200c4f9c74fbaa4c0e..ddf45cf59734d8b5a1ee08d1c97bcd01a78106a3 100644 (file)
@@ -1124,17 +1124,17 @@ ERROR:  positional argument cannot follow named argument
 LINE 1: select * from dfunc(10, b := 20, 30);
                                          ^
 select * from dfunc(x := 10, b := 20, c := 30);  -- fail, unknown param
-ERROR:  function dfunc(x := integer, b := integer, c := integer) does not exist
+ERROR:  function dfunc(x => integer, b => integer, c => integer) does not exist
 LINE 1: select * from dfunc(x := 10, b := 20, c := 30);
                       ^
 HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
 select * from dfunc(10, 10, a := 20);  -- fail, a overlaps positional parameter
-ERROR:  function dfunc(integer, integer, a := integer) does not exist
+ERROR:  function dfunc(integer, integer, a => integer) does not exist
 LINE 1: select * from dfunc(10, 10, a := 20);
                       ^
 HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
 select * from dfunc(1,c := 2,d := 3); -- fail, no value for b
-ERROR:  function dfunc(integer, c := integer, d := integer) does not exist
+ERROR:  function dfunc(integer, c => integer, d => integer) does not exist
 LINE 1: select * from dfunc(1,c := 2,d := 3);
                       ^
 HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
@@ -1175,7 +1175,7 @@ select * from dfunc('Hello World', c := '2009-07-25'::date, b := 20);
 (1 row)
 
 select * from dfunc('Hello World', c := 20, b := '2009-07-25'::date);  -- fail
-ERROR:  function dfunc(unknown, c := integer, b := date) does not exist
+ERROR:  function dfunc(unknown, c => integer, b => date) does not exist
 LINE 1: select * from dfunc('Hello World', c := 20, b := '2009-07-25...
                       ^
 HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
@@ -1450,8 +1450,8 @@ select * from dfview;
 View definition:
  SELECT int8_tbl.q1,
     int8_tbl.q2,
-    dfunc(int8_tbl.q1, int8_tbl.q2, flag := int8_tbl.q1 > int8_tbl.q2) AS c3,
-    dfunc(int8_tbl.q1, flag := int8_tbl.q1 < int8_tbl.q2, b := int8_tbl.q2) AS c4
+    dfunc(int8_tbl.q1, int8_tbl.q2, flag => int8_tbl.q1 > int8_tbl.q2) AS c3,
+    dfunc(int8_tbl.q1, flag => int8_tbl.q1 < int8_tbl.q2, b => int8_tbl.q2) AS c4
    FROM int8_tbl;
 
 drop view dfview;