diff options
author | Robert Haas <rhaas@postgresql.org> | 2015-03-10 10:59:11 -0400 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2015-03-10 11:09:41 -0400 |
commit | 865f14a2d31af23a05bbf2df04c274629c5d5c4d (patch) | |
tree | c9c7e2f919ab55a7c695a572692462f1e6515d8b /src/test/regress/sql/polymorphism.sql | |
parent | 4f3924d9cd438ba4e6fd639460f8c859c65d45a3 (diff) |
Allow named parameters to be specified using => in addition to :=
SQL has standardized on => as the use of to specify named parameters,
and we've wanted for many years to support the same syntax ourselves,
but this has been complicated by the possible use of => as an operator
name. In PostgreSQL 9.0, we began emitting a warning when an operator
named => was defined, and in PostgreSQL 9.2, we stopped shipping a
=>(text, text) operator as part of hstore. By the time the next major
version of PostgreSQL is released, => will have been deprecated for a
full five years, so hopefully there won't be too many people still
relying on it. We continue to support := for compatibility with
previous PostgreSQL releases.
Pavel Stehule, reviewed by Petr Jelinek, with a few documentation
tweaks by me.
Diffstat (limited to 'src/test/regress/sql/polymorphism.sql')
-rw-r--r-- | src/test/regress/sql/polymorphism.sql | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/test/regress/sql/polymorphism.sql b/src/test/regress/sql/polymorphism.sql index 3d8dd1e5548..72f6cb5e7cb 100644 --- a/src/test/regress/sql/polymorphism.sql +++ b/src/test/regress/sql/polymorphism.sql @@ -748,6 +748,22 @@ select dfunc('a'::text, 'b', flag := false); -- mixed notation select dfunc('a'::text, 'b', true); -- full positional notation select dfunc('a'::text, 'b', flag := true); -- mixed notation +-- ansi/sql syntax +select dfunc(a => 1, b => 2); +select dfunc(a => 'a'::text, b => 'b'); +select dfunc(a => 'a'::text, b => 'b', flag => false); -- named notation + +select dfunc(b => 'b'::text, a => 'a'); -- named notation with default +select dfunc(a => 'a'::text, flag => true); -- named notation with default +select dfunc(a => 'a'::text, flag => false); -- named notation with default +select dfunc(b => 'b'::text, a => 'a', flag => true); -- named notation + +select dfunc('a'::text, 'b', false); -- full positional notation +select dfunc('a'::text, 'b', flag => false); -- mixed notation +select dfunc('a'::text, 'b', true); -- full positional notation +select dfunc('a'::text, 'b', flag => true); -- mixed notation + + -- check reverse-listing of named-arg calls CREATE VIEW dfview AS SELECT q1, q2, |