Lines Matching refs:dfunc

536 create function dfunc(a int = 1, int = 2) returns int as $$  function
540 select dfunc();
541 select dfunc(10);
542 select dfunc(10, 20);
543 select dfunc(10, 20, 30); -- fail
545 drop function dfunc(); -- fail
546 drop function dfunc(int); -- fail
547 drop function dfunc(int, int); -- ok
550 create function dfunc(a int = 1, b int) returns int as $$ function
555 create function dfunc(a int = 1, out sum int, b int = 2) as $$ function
559 select dfunc();
562 \df dfunc
564 drop function dfunc(int, int);
567 create function dfunc(a int DEFAULT 1.0, int DEFAULT '-1') returns int as $$ function
570 select dfunc();
572 create function dfunc(a text DEFAULT 'Hello', b text DEFAULT 'World') returns text as $$ function
576 select dfunc(); -- fail: which dfunc should be called? int or text
577 select dfunc('Hi'); -- ok
578 select dfunc('Hi', 'City'); -- ok
579 select dfunc(0); -- ok
580 select dfunc(10, 20); -- ok
582 drop function dfunc(int, int);
583 drop function dfunc(text, text);
585 create function dfunc(int = 1, int = 2) returns int as $$ function
589 create function dfunc(int = 1, int = 2, int = 3, int = 4) returns int as $$ function
596 select dfunc(); -- fail
597 select dfunc(1); -- fail
598 select dfunc(1, 2); -- fail
599 select dfunc(1, 2, 3); -- ok
600 select dfunc(1, 2, 3, 4); -- ok
602 drop function dfunc(int, int);
603 drop function dfunc(int, int, int, int);
606 create function dfunc(out int = 20) returns int as $$ function
611 create function dfunc(anyelement = 'World'::text) returns text as $$ function
615 select dfunc();
616 select dfunc(0);
617 select dfunc(to_date('20081215','YYYYMMDD'));
618 select dfunc('City'::text);
620 drop function dfunc(anyelement);
624 create function dfunc(a variadic int[]) returns int as function
627 select dfunc(); -- fail
628 select dfunc(10);
629 select dfunc(10,20);
631 create or replace function dfunc(a variadic int[] default array[]::int[]) returns int as function
634 select dfunc(); -- now ok
635 select dfunc(10);
636 select dfunc(10,20);
639 create or replace function dfunc(a variadic int[]) returns int as function
642 \df dfunc
644 drop function dfunc(a variadic int[]);
648 create function dfunc(int = 1, int = 2, int = 3) returns int as $$ function
652 create function dfunc(int = 1, int = 2) returns int as $$ function
656 create function dfunc(text) returns text as $$ function
661 select dfunc(1); -- fail
664 select dfunc('Hi');
666 drop function dfunc(int, int, int);
667 drop function dfunc(int, int);
668 drop function dfunc(text);
674 create function dfunc(a int, b int, c int = 0, d int = 0) function
679 select (dfunc(10,20,30)).*;
680 select (dfunc(a := 10, b := 20, c := 30)).*;
681 select * from dfunc(a := 10, b := 20);
682 select * from dfunc(b := 10, a := 20);
683 select * from dfunc(0); -- fail
684 select * from dfunc(1,2);
685 select * from dfunc(1,2,c := 3);
686 select * from dfunc(1,2,d := 3);
688 select * from dfunc(x := 20, b := 10, x := 30); -- fail, duplicate name
689 select * from dfunc(10, b := 20, 30); -- fail, named args must be last
690 select * from dfunc(x := 10, b := 20, c := 30); -- fail, unknown param
691 select * from dfunc(10, 10, a := 20); -- fail, a overlaps positional parameter
692 select * from dfunc(1,c := 2,d := 3); -- fail, no value for b
694 drop function dfunc(int, int, int, int);
697 create function dfunc(a varchar, b numeric, c date = current_date) function
702 select (dfunc('Hello World', 20, '2009-07-25'::date)).*;
703 select * from dfunc('Hello World', 20, '2009-07-25'::date);
704 select * from dfunc(c := '2009-07-25'::date, a := 'Hello World', b := 20);
705 select * from dfunc('Hello World', b := 20, c := '2009-07-25'::date);
706 select * from dfunc('Hello World', c := '2009-07-25'::date, b := 20);
707 select * from dfunc('Hello World', c := 20, b := '2009-07-25'::date); -- fail
709 drop function dfunc(varchar, numeric, date);
712 create function dfunc(a varchar = 'def a', out _a varchar, c numeric = NULL, out _c numeric) function
717 select (dfunc()).*;
718 select * from dfunc();
719 select * from dfunc('Hello', 100);
720 select * from dfunc(a := 'Hello', c := 100);
721 select * from dfunc(c := 100, a := 'Hello');
722 select * from dfunc('Hello');
723 select * from dfunc('Hello', c := 100);
724 select * from dfunc(c := 100);
727 create or replace function dfunc(a varchar = 'def a', out _a varchar, x numeric = NULL, out _c nume… function
732 create or replace function dfunc(a varchar = 'def a', out _a varchar, numeric = NULL, out _c numeri… function
737 drop function dfunc(varchar, numeric);
754 create function dfunc(a anyelement, b anyelement = null, flag bool = true) function
759 select dfunc(1,2);
760 select dfunc('a'::text, 'b'); -- positional notation with default
762 select dfunc(a := 1, b := 2);
763 select dfunc(a := 'a'::text, b := 'b');
764 select dfunc(a := 'a'::text, b := 'b', flag := false); -- named notation
766 select dfunc(b := 'b'::text, a := 'a'); -- named notation with default
767 select dfunc(a := 'a'::text, flag := true); -- named notation with default
768 select dfunc(a := 'a'::text, flag := false); -- named notation with default
769 select dfunc(b := 'b'::text, a := 'a', flag := true); -- named notation
771 select dfunc('a'::text, 'b', false); -- full positional notation
772 select dfunc('a'::text, 'b', flag := false); -- mixed notation
773 select dfunc('a'::text, 'b', true); -- full positional notation
774 select dfunc('a'::text, 'b', flag := true); -- mixed notation
777 select dfunc(a => 1, b => 2);
778 select dfunc(a => 'a'::text, b => 'b');
779 select dfunc(a => 'a'::text, b => 'b', flag => false); -- named notation
781 select dfunc(b => 'b'::text, a => 'a'); -- named notation with default
782 select dfunc(a => 'a'::text, flag => true); -- named notation with default
783 select dfunc(a => 'a'::text, flag => false); -- named notation with default
784 select dfunc(b => 'b'::text, a => 'a', flag => true); -- named notation
786 select dfunc('a'::text, 'b', false); -- full positional notation
787 select dfunc('a'::text, 'b', flag => false); -- mixed notation
788 select dfunc('a'::text, 'b', true); -- full positional notation
789 select dfunc('a'::text, 'b', flag => true); -- mixed notation
792 select dfunc(a =>-1);
793 select dfunc(a =>+1);
794 select dfunc(a =>/**/1);
795 select dfunc(a =>--comment to be removed by psql
801 select dfunc(a=>-- comment
810 dfunc(q1,q2, flag := q1>q2) as c3,
811 dfunc(q1, flag := q1<q2, b := q2) as c4
819 drop function dfunc(anyelement, anyelement, bool);