pl/python invalidate functions with composite arguments
Вложения
В списке pgsql-hackers по дате отправления:
| От | Jan Urbański |
|---|---|
| Тема | pl/python invalidate functions with composite arguments |
| Дата | |
| Msg-id | 4D1353B6.1050806@wulczer.org обсуждение исходный текст |
| Ответы |
Re: pl/python invalidate functions with composite arguments
|
| Список | pgsql-hackers |
Here's a patch implementing properly invalidating functions that have composite type arguments after the type changes, as mentioned in http://archives.postgresql.org/pgsql-hackers/2010-12/msg01991.php. It's an incremental patch on top of the plpython-refactor patch sent eariler. Git branch for this patch: https://github.com/wulczer/postgres/tree/invalidate-composites. The idea in general is for this to work (taken straight from the unit tests, btw) 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 $$ return e['basesalary'] + e['bonus'] $$ LANGUAGE plpythonu; SELECT name, test_composite_table_input(employee.*) FROM employee; ALTER TABLE employee DROP bonus; -- this fails SELECT name, test_composite_table_input(employee.*) FROM employee; ALTER TABLE employee ADD bonus integer; UPDATE employee SET bonus = 10; -- this works again SELECT name, test_composite_table_input(employee.*) FROM employee; It's a long-standing TODO item, and a generally good thing to do. Cheers, Jan
В списке pgsql-hackers по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера