summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2001-06-04 23:27:23 +0000
committerBruce Momjian <bruce@momjian.us>2001-06-04 23:27:23 +0000
commit28d2420eefdacfa928138d4b302fd6a31286225b (patch)
tree73df5116c5775c04e5e0fbc628e38611d6dd6851 /src/test
parent0a93285d88136df76b88247c5b5ddf3d4b418be4 (diff)
This patch adds support for %TYPE in CREATE FUNCTION argument and return
types. This version has an elog() to remind the user the type resolution is not dynamic. Ian Lance Taylor
Diffstat (limited to 'src/test')
-rw-r--r--src/test/regress/input/create_function_2.source6
-rw-r--r--src/test/regress/input/misc.source1
-rw-r--r--src/test/regress/output/create_function_2.source6
-rw-r--r--src/test/regress/output/misc.source6
4 files changed, 19 insertions, 0 deletions
diff --git a/src/test/regress/input/create_function_2.source b/src/test/regress/input/create_function_2.source
index b1c0eab1386..4bcf24c6011 100644
--- a/src/test/regress/input/create_function_2.source
+++ b/src/test/regress/input/create_function_2.source
@@ -13,6 +13,12 @@ CREATE FUNCTION hobby_construct(text, text)
LANGUAGE 'sql';
+CREATE FUNCTION hobbies_by_name(hobbies_r.name%TYPE)
+ RETURNS hobbies_r.person%TYPE
+ AS 'select person from hobbies_r where name = $1'
+ LANGUAGE 'sql';
+
+
CREATE FUNCTION equipment(hobbies_r)
RETURNS setof equipment_r
AS 'select * from equipment_r where hobby = $1.name'
diff --git a/src/test/regress/input/misc.source b/src/test/regress/input/misc.source
index dbb8df84709..0fa63839e60 100644
--- a/src/test/regress/input/misc.source
+++ b/src/test/regress/input/misc.source
@@ -214,6 +214,7 @@ SELECT user_relns() AS user_relns
--SELECT name(equipment(hobby_construct(text 'skywalking', text 'mer'))) AS equip_name;
+SELECT hobbies_by_name('basketball');
--
-- check that old-style C functions work properly with TOASTed values
diff --git a/src/test/regress/output/create_function_2.source b/src/test/regress/output/create_function_2.source
index a5f39a00bb0..137242da705 100644
--- a/src/test/regress/output/create_function_2.source
+++ b/src/test/regress/output/create_function_2.source
@@ -9,6 +9,12 @@ CREATE FUNCTION hobby_construct(text, text)
RETURNS hobbies_r
AS 'select $1 as name, $2 as hobby'
LANGUAGE 'sql';
+CREATE FUNCTION hobbies_by_name(hobbies_r.name%TYPE)
+ RETURNS hobbies_r.person%TYPE
+ AS 'select person from hobbies_r where name = $1'
+ LANGUAGE 'sql';
+NOTICE: hobbies_r.name%TYPE converted to text
+NOTICE: hobbies_r.person%TYPE converted to text
CREATE FUNCTION equipment(hobbies_r)
RETURNS setof equipment_r
AS 'select * from equipment_r where hobby = $1.name'
diff --git a/src/test/regress/output/misc.source b/src/test/regress/output/misc.source
index 768dba5c3c7..57dc0fb4a42 100644
--- a/src/test/regress/output/misc.source
+++ b/src/test/regress/output/misc.source
@@ -656,6 +656,12 @@ SELECT user_relns() AS user_relns
(90 rows)
--SELECT name(equipment(hobby_construct(text 'skywalking', text 'mer'))) AS equip_name;
+SELECT hobbies_by_name('basketball');
+ hobbies_by_name
+-----------------
+ joe
+(1 row)
+
--
-- check that old-style C functions work properly with TOASTed values
--