2001-05-09 15:54:38 -04:00
|
|
|
-- first some tests of basic functionality
|
|
|
|
|
--
|
|
|
|
|
-- better succeed
|
|
|
|
|
--
|
|
|
|
|
select stupid();
|
|
|
|
|
|
|
|
|
|
-- check static and global data
|
|
|
|
|
--
|
|
|
|
|
SELECT static_test();
|
|
|
|
|
SELECT static_test();
|
|
|
|
|
SELECT global_test_one();
|
|
|
|
|
SELECT global_test_two();
|
|
|
|
|
|
|
|
|
|
-- import python modules
|
|
|
|
|
--
|
|
|
|
|
SELECT import_fail();
|
|
|
|
|
SELECT import_succeed();
|
|
|
|
|
|
|
|
|
|
-- test import and simple argument handling
|
|
|
|
|
--
|
|
|
|
|
SELECT import_test_one('sha hash of this string');
|
|
|
|
|
|
|
|
|
|
-- test import and tuple argument handling
|
|
|
|
|
--
|
|
|
|
|
select import_test_two(users) from users where fname = 'willem';
|
|
|
|
|
|
|
|
|
|
-- test multiple arguments
|
|
|
|
|
--
|
2001-05-12 13:49:32 -04:00
|
|
|
select argument_test_one(users, fname, lname) from users where lname = 'doe' order by 1;
|
2001-05-09 15:54:38 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
-- spi and nested calls
|
|
|
|
|
--
|
|
|
|
|
select nested_call_one('pass this along');
|
|
|
|
|
select spi_prepared_plan_test_one('doe');
|
|
|
|
|
select spi_prepared_plan_test_one('smith');
|
|
|
|
|
select spi_prepared_plan_test_nested('smith');
|
|
|
|
|
|
|
|
|
|
-- quick peek at the table
|
|
|
|
|
--
|
|
|
|
|
SELECT * FROM users;
|
|
|
|
|
|
|
|
|
|
-- should fail
|
|
|
|
|
--
|
|
|
|
|
UPDATE users SET fname = 'william' WHERE fname = 'willem';
|
|
|
|
|
|
|
|
|
|
-- should modify william to willem and create username
|
|
|
|
|
--
|
|
|
|
|
INSERT INTO users (fname, lname) VALUES ('william', 'smith');
|
|
|
|
|
INSERT INTO users (fname, lname, username) VALUES ('charles', 'darwin', 'beagle');
|
|
|
|
|
|
|
|
|
|
SELECT * FROM users;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT join_sequences(sequences) FROM sequences;
|
|
|
|
|
SELECT join_sequences(sequences) FROM sequences
|
|
|
|
|
WHERE join_sequences(sequences) ~* '^A';
|
|
|
|
|
SELECT join_sequences(sequences) FROM sequences
|
|
|
|
|
WHERE join_sequences(sequences) ~* '^B';
|
|
|
|
|
|
|
|
|
|
-- error in trigger
|
|
|
|
|
--
|
|
|
|
|
|
2005-03-24 12:22:34 -05:00
|
|
|
--
|
|
|
|
|
-- Check Universal Newline Support
|
|
|
|
|
--
|
|
|
|
|
|
|
|
|
|
SELECT newline_lf();
|
|
|
|
|
SELECT newline_cr();
|
|
|
|
|
SELECT newline_crlf();
|
2006-02-28 15:03:52 -05:00
|
|
|
|
|
|
|
|
-- Tests for functions returning void
|
|
|
|
|
SELECT test_void_func1(), test_void_func1() IS NULL AS "is null";
|
|
|
|
|
SELECT test_void_func2(); -- should fail
|
|
|
|
|
SELECT test_return_none(), test_return_none() IS NULL AS "is null";
|