1 -- first some tests of basic functionality
7 -- check static and global data
11 SELECT global_test_one();
12 SELECT global_test_two();
14 -- import python modules
17 SELECT import_succeed();
19 -- test import and simple argument handling
21 SELECT import_test_one('sha hash of this string');
23 -- test import and tuple argument handling
25 select import_test_two(users) from users where fname = 'willem';
27 -- test multiple arguments
29 select argument_test_one(users, fname, lname) from users where lname = 'doe' order by 1;
32 -- spi and nested calls
34 select nested_call_one('pass this along');
35 select spi_prepared_plan_test_one('doe');
36 select spi_prepared_plan_test_one('smith');
37 select spi_prepared_plan_test_nested('smith');
39 -- quick peek at the table
45 UPDATE users SET fname = 'william' WHERE fname = 'willem';
47 -- should modify william to willem and create username
49 INSERT INTO users (fname, lname) VALUES ('william', 'smith');
50 INSERT INTO users (fname, lname, username) VALUES ('charles', 'darwin', 'beagle');
55 SELECT join_sequences(sequences) FROM sequences;
56 SELECT join_sequences(sequences) FROM sequences
57 WHERE join_sequences(sequences) ~* '^A';
58 SELECT join_sequences(sequences) FROM sequences
59 WHERE join_sequences(sequences) ~* '^B';
65 -- Check Universal Newline Support
70 SELECT newline_crlf();
72 -- Tests for functions returning void
73 SELECT test_void_func1(), test_void_func1() IS NULL AS "is null";
74 SELECT test_void_func2(); -- should fail
75 SELECT test_return_none(), test_return_none() IS NULL AS "is null";
77 -- Test for functions with named parameters
78 SELECT test_param_names1(1,'text');
79 SELECT test_param_names2(users) from users;
80 SELECT test_param_names3(1);
82 -- Test set returning functions
83 SELECT test_setof_as_list(0, 'list');
84 SELECT test_setof_as_list(1, 'list');
85 SELECT test_setof_as_list(2, 'list');
86 SELECT test_setof_as_list(2, null);
88 SELECT test_setof_as_tuple(0, 'tuple');
89 SELECT test_setof_as_tuple(1, 'tuple');
90 SELECT test_setof_as_tuple(2, 'tuple');
91 SELECT test_setof_as_tuple(2, null);
93 SELECT test_setof_as_iterator(0, 'list');
94 SELECT test_setof_as_iterator(1, 'list');
95 SELECT test_setof_as_iterator(2, 'list');
96 SELECT test_setof_as_iterator(2, null);
98 -- Test tuple returning functions
99 SELECT * FROM test_table_record_as('dict', null, null, false);
100 SELECT * FROM test_table_record_as('dict', 'one', null, false);
101 SELECT * FROM test_table_record_as('dict', null, 2, false);
102 SELECT * FROM test_table_record_as('dict', 'three', 3, false);
103 SELECT * FROM test_table_record_as('dict', null, null, true);
105 SELECT * FROM test_table_record_as('tuple', null, null, false);
106 SELECT * FROM test_table_record_as('tuple', 'one', null, false);
107 SELECT * FROM test_table_record_as('tuple', null, 2, false);
108 SELECT * FROM test_table_record_as('tuple', 'three', 3, false);
109 SELECT * FROM test_table_record_as('tuple', null, null, true);
111 SELECT * FROM test_table_record_as('list', null, null, false);
112 SELECT * FROM test_table_record_as('list', 'one', null, false);
113 SELECT * FROM test_table_record_as('list', null, 2, false);
114 SELECT * FROM test_table_record_as('list', 'three', 3, false);
115 SELECT * FROM test_table_record_as('list', null, null, true);
117 SELECT * FROM test_table_record_as('obj', null, null, false);
118 SELECT * FROM test_table_record_as('obj', 'one', null, false);
119 SELECT * FROM test_table_record_as('obj', null, 2, false);
120 SELECT * FROM test_table_record_as('obj', 'three', 3, false);
121 SELECT * FROM test_table_record_as('obj', null, null, true);
123 SELECT * FROM test_type_record_as('dict', null, null, false);
124 SELECT * FROM test_type_record_as('dict', 'one', null, false);
125 SELECT * FROM test_type_record_as('dict', null, 2, false);
126 SELECT * FROM test_type_record_as('dict', 'three', 3, false);
127 SELECT * FROM test_type_record_as('dict', null, null, true);
129 SELECT * FROM test_type_record_as('tuple', null, null, false);
130 SELECT * FROM test_type_record_as('tuple', 'one', null, false);
131 SELECT * FROM test_type_record_as('tuple', null, 2, false);
132 SELECT * FROM test_type_record_as('tuple', 'three', 3, false);
133 SELECT * FROM test_type_record_as('tuple', null, null, true);
135 SELECT * FROM test_type_record_as('list', null, null, false);
136 SELECT * FROM test_type_record_as('list', 'one', null, false);
137 SELECT * FROM test_type_record_as('list', null, 2, false);
138 SELECT * FROM test_type_record_as('list', 'three', 3, false);
139 SELECT * FROM test_type_record_as('list', null, null, true);
141 SELECT * FROM test_type_record_as('obj', null, null, false);
142 SELECT * FROM test_type_record_as('obj', 'one', null, false);
143 SELECT * FROM test_type_record_as('obj', null, 2, false);
144 SELECT * FROM test_type_record_as('obj', 'three', 3, false);
145 SELECT * FROM test_type_record_as('obj', null, null, true);
147 SELECT * FROM test_in_out_params('test_in');
148 -- this doesn't work yet :-(
149 SELECT * FROM test_in_out_params_multi('test_in');
150 SELECT * FROM test_inout_params('test_in');