mirror of
https://git.postgresql.org/git/postgresql.git
synced 2026-02-07 14:47:34 +08:00
Table function support for PL/Python
This allows functions with multiple OUT parameters returning both one or multiple records (RECORD or SETOF RECORD). Jan Urbański, reviewed by Hitoshi Harada
This commit is contained in:
@ -549,3 +549,21 @@ SELECT * FROM pb;
|
||||
b | 2010-10-13 21:57:29
|
||||
(1 row)
|
||||
|
||||
-- triggers for tables with composite types
|
||||
CREATE TABLE comp1 (i integer, j boolean);
|
||||
CREATE TYPE comp2 AS (k integer, l boolean);
|
||||
CREATE TABLE composite_trigger_test (f1 comp1, f2 comp2);
|
||||
CREATE FUNCTION composite_trigger_f() RETURNS trigger AS $$
|
||||
TD['new']['f1'] = (3, False)
|
||||
TD['new']['f2'] = {'k': 7, 'l': 'yes', 'ignored': 10}
|
||||
return 'MODIFY'
|
||||
$$ LANGUAGE plpythonu;
|
||||
CREATE TRIGGER composite_trigger BEFORE INSERT ON composite_trigger_test
|
||||
FOR EACH ROW EXECUTE PROCEDURE composite_trigger_f();
|
||||
INSERT INTO composite_trigger_test VALUES (NULL, NULL);
|
||||
SELECT * FROM composite_trigger_test;
|
||||
f1 | f2
|
||||
-------+-------
|
||||
(3,f) | (7,t)
|
||||
(1 row)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user