aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2015-05-01 09:37:10 -0400
committerRobert Haas <rhaas@postgresql.org>2015-05-01 09:37:10 -0400
commite044a44949c5b9c9f548e8a1cd4bf0b50fb2a1cc (patch)
tree97c0dc3d6f86fd9286fb70ef421812769c478f75
parente7cb7ee14555cc9c5773e2c102efd6371f6f2005 (diff)
downloadpostgresql-e044a44949c5b9c9f548e8a1cd4bf0b50fb2a1cc.tar.gz
postgresql-e044a44949c5b9c9f548e8a1cd4bf0b50fb2a1cc.zip
Deparse named arguments to use the new => operator instead of :=
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.
-rw-r--r--src/backend/parser/parse_func.c2
-rw-r--r--src/backend/utils/adt/ruleutils.c2
-rw-r--r--src/test/regress/expected/polymorphism.out12
3 files changed, 8 insertions, 8 deletions
diff --git a/src/backend/parser/parse_func.c b/src/backend/parser/parse_func.c
index 1385776f6bd..f7affebf84e 100644
--- a/src/backend/parser/parse_func.c
+++ b/src/backend/parser/parse_func.c
@@ -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]));
diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c
index 29d1210e05c..fea8db6a533 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -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;
diff --git a/src/test/regress/expected/polymorphism.out b/src/test/regress/expected/polymorphism.out
index 987b3eed7d3..ddf45cf5973 100644
--- a/src/test/regress/expected/polymorphism.out
+++ b/src/test/regress/expected/polymorphism.out
@@ -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;