aboutsummaryrefslogtreecommitdiff
path: root/src/pl/plpython/sql/plpython_test.sql
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2005-05-14 17:55:22 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2005-05-14 17:55:22 +0000
commit0ff7a2c2ad04404aeb1f45e1ae5d67dc91b575ee (patch)
treea7ce4d78d12e02b1852bc75c502ff878d9d50aed /src/pl/plpython/sql/plpython_test.sql
parent1ea069b1f61aee5e901886aee8b51051e00aad54 (diff)
downloadpostgresql-0ff7a2c2ad04404aeb1f45e1ae5d67dc91b575ee.tar.gz
postgresql-0ff7a2c2ad04404aeb1f45e1ae5d67dc91b575ee.zip
Convert the existing regression test scripts for the various optional
PLs to use the standard pg_regress infrastructure. No changes in the tests themselves. Andrew Dunstan
Diffstat (limited to 'src/pl/plpython/sql/plpython_test.sql')
-rw-r--r--src/pl/plpython/sql/plpython_test.sql70
1 files changed, 70 insertions, 0 deletions
diff --git a/src/pl/plpython/sql/plpython_test.sql b/src/pl/plpython/sql/plpython_test.sql
new file mode 100644
index 00000000000..17d6b2e7922
--- /dev/null
+++ b/src/pl/plpython/sql/plpython_test.sql
@@ -0,0 +1,70 @@
+-- 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
+--
+select argument_test_one(users, fname, lname) from users where lname = 'doe' order by 1;
+
+
+-- 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
+--
+
+--
+-- Check Universal Newline Support
+--
+
+SELECT newline_lf();
+SELECT newline_cr();
+SELECT newline_crlf();