ERROR when table defination changes
BaiShaoqi opened this issue · 1 comments
BaiShaoqi commented
Expected behavior
name | test_composite_table_input
------+----------------------------
John | 110
Mary | 210
(2 rows)
ERROR: KeyError: 'bonus' (plpython.c:4960) (seg0 slice1 10.152.10.139:25432 pid=5868) (cdbdisp.c:254)
DETAIL:
Traceback (most recent call last):
PL/Python function "test_composite_table_input", line 2, in <module>
return e['basesalary'] + e['bonus']
PL/Python function "test_composite_table_input"
Actual behavior
name | test_composite_table_input
------+----------------------------
Mary | 210
John | 110
(2 rows)
name | test_composite_table_input
------+----------------------------
John | 110
Mary | 210
(2 rows)
Step to reproduce the behavior
CREATE TABLE employee (
name text,
basesalary integer,
bonus integer
);
INSERT INTO employee VALUES ('John', 100, 10), ('Mary', 200, 10);
CREATE OR REPLACE FUNCTION test_composite_table_input(e employee) RETURNS integer AS $$
# container: plc_python_shared
return e['basesalary'] + e['bonus']
$$ LANGUAGE plcontainer;
SELECT name, test_composite_table_input(employee.*) FROM employee;
ALTER TABLE employee DROP bonus;
SELECT name, test_composite_table_input(employee.*) FROM employee;