]> granicus.if.org Git - postgresql/blob - src/pl/plpython/sql/plpython_test.sql
Convert the existing regression test scripts for the various optional
[postgresql] / src / pl / plpython / sql / plpython_test.sql
1 -- first some tests of basic functionality
2 --
3 -- better succeed
4 --
5 select stupid();
6
7 -- check static and global data
8 --
9 SELECT static_test();
10 SELECT static_test();
11 SELECT global_test_one();
12 SELECT global_test_two();
13
14 -- import python modules
15 --
16 SELECT import_fail();
17 SELECT import_succeed();
18
19 -- test import and simple argument handling
20 --
21 SELECT import_test_one('sha hash of this string');
22
23 -- test import and tuple argument handling
24 --
25 select import_test_two(users) from users where fname = 'willem';
26
27 -- test multiple arguments
28 --
29 select argument_test_one(users, fname, lname) from users where lname = 'doe' order by 1;
30
31
32 -- spi and nested calls
33 --
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');
38
39 -- quick peek at the table
40 --
41 SELECT * FROM users;
42
43 -- should fail
44 --
45 UPDATE users SET fname = 'william' WHERE fname = 'willem';
46
47 -- should modify william to willem and create username
48 --
49 INSERT INTO users (fname, lname) VALUES ('william', 'smith');
50 INSERT INTO users (fname, lname, username) VALUES ('charles', 'darwin', 'beagle');
51
52 SELECT * FROM users;
53
54
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';
60
61 -- error in trigger
62 --
63
64 --
65 -- Check Universal Newline Support
66 --
67
68 SELECT newline_lf();
69 SELECT newline_cr();
70 SELECT newline_crlf();