postgresql/src/pl/plpython/sql/plpython_test.sql

22 lines
580 B
MySQL
Raw Normal View History

2001-05-09 15:54:38 -04:00
-- first some tests of basic functionality
-- really stupid function just to get the module loaded
CREATE FUNCTION stupid() RETURNS text AS 'return "zarkon"' LANGUAGE plpythonu;
2001-05-09 15:54:38 -04:00
select stupid();
2001-05-09 15:54:38 -04:00
-- test multiple arguments
CREATE FUNCTION argument_test_one(u users, a1 text, a2 text) RETURNS text
AS
'keys = u.keys()
keys.sort()
out = []
for key in keys:
out.append("%s: %s" % (key, u[key]))
words = a1 + " " + a2 + " => {" + ", ".join(out) + "}"
return words'
LANGUAGE plpythonu;
select argument_test_one(users, fname, lname) from users where lname = 'doe' order by 1;