在 Postgres 中,如何在更改表后重新验证 ("type-check") 函数和过程?
In Postgres, how do I re-validate ("type-check") functions and procedures after tables are altered?
在 Postgres 中,函数在创建时进行验证:例如,访问不存在的列会导致有用的错误,甚至在函数 运行 之前。但是更改 table 不会验证与函数定义的一致性,即删除某个函数使用的列不会导致错误。有没有什么方法可以重新运行在创建时已经应用于函数的相同验证,而不删除和重新创建每个函数?
没有内置的东西,但有一个扩展可以做到这一点:
来自项目的自述文件:
Features
- check fields of referenced database objects and types inside embedded SQL
- using correct types of function parameters
- unused variables and function argumens, unmodified OUT argumens
- partially detection of dead code (due RETURN command)
- detection of missing RETURN command in function
- try to identify unwanted hidden casts, that can be performance issue like unused indexes
- possibility to collect relations and functions used by function
- possibility to check EXECUTE stmt agaist SQL injection vulnerability
在 Postgres 中,函数在创建时进行验证:例如,访问不存在的列会导致有用的错误,甚至在函数 运行 之前。但是更改 table 不会验证与函数定义的一致性,即删除某个函数使用的列不会导致错误。有没有什么方法可以重新运行在创建时已经应用于函数的相同验证,而不删除和重新创建每个函数?
没有内置的东西,但有一个扩展可以做到这一点:
来自项目的自述文件:
Features
- check fields of referenced database objects and types inside embedded SQL
- using correct types of function parameters
- unused variables and function argumens, unmodified OUT argumens
- partially detection of dead code (due RETURN command)
- detection of missing RETURN command in function
- try to identify unwanted hidden casts, that can be performance issue like unused indexes
- possibility to collect relations and functions used by function
- possibility to check EXECUTE stmt agaist SQL injection vulnerability