Help Center/
GaussDB/
Developer Guide(Centralized_V2.0-8.x)/
Stored Procedure/
Recompilation upon Expiration/
Overview of Recompilation upon Expiration
Updated on 2025-05-29 GMT+08:00
Overview of Recompilation upon Expiration
Recompilation upon expiration provides one-off import, recompilation upon expiration, and cascading invalidation functions.
- One-off import: Use undefined objects for newly created stored procedures, functions, and packages. For example, if a table, function, or type does not exist, it can be created and an alarm is printed. The value of the valid column in the pg_object system catalog is false.
- Recompilation upon expiration: If all undefined objects exist, run the advanced package of recompilation upon expiration pkg_util.gs_compile_schema or alter compile function to validate the objects, and then the stored procedures, functions, and packages are executed normally.
- Cascading invalidation: When depended objects are deleted, dependent objects are not deleted cascadingly but invalidated. For example, when the input and output parameters of a function depend on a table, the function is invalidated when the table is deleted, but the function is not deleted cascadingly.
- Package header re-creation without deleting the original package body: When CREATE OR REPLACE PACKAGE is used to overwrite the original package header definition, the existing package body definition is not deleted but invalidated. The ALTER COMPILE function can be used to make the package body valid.
To use this function, you are advised to enable the following GUC parameters:
- Set enable_force_create_obj to on to enable the one-off import function.
- Set ddl_invalid_mode to 'invalid' to enable the cascading invalidation function.

- Centralized A-compatible databases are supported.
- After the parameter for recompilation upon expiration is enabled, if invalid objects of user-defined functions exist in the database, the \df command cannot be used to query all or a single invalid function, and an error message is displayed, indicating that invalid objects exist.
- If a view depends on a function and the depended function is rebuilt, only the view that has the same schema as the function can be automatically rebuilt. In other scenarios, you need to manually rebuild the view.
- The dependency of synonyms cannot be recorded. The dependency of the original object to which a synonym points is recorded.
- The dependency of temporary tables cannot be recorded.
- The dependency of materialized views cannot be recorded.
- When the execution blocks of a package and a function access other objects, the dependency can be recorded only for scenarios where the function is directly called, the function in the package is directly called, and the package variable is directly accessed.
- When default values or expression rvalues of the package and function variables are used, the dependency can be recorded only for scenarios where the function is directly called, the function in the package is directly called, and the package variable is directly accessed.
- When the autonomous transaction function is called and the nested compilation of the dependent object is triggered, but the status of the dependent object is not updated, you need to manually use ALTER PACKAGE to update the status.
- When the CAST type of anonymous blocks and function parameters is converted to the invalid package type, you need to manually use ALTER PACKAGE to update the package type.
Parent topic: Recompilation upon Expiration
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot