diff --git a/src/gausskernel/process/tcop/postgres.cpp b/src/gausskernel/process/tcop/postgres.cpp index bce6dcd82..bcf1997f0 100755 --- a/src/gausskernel/process/tcop/postgres.cpp +++ b/src/gausskernel/process/tcop/postgres.cpp @@ -973,6 +973,14 @@ bool IsFileExisted(const char *filename) return file_exists(fullname); } +#define APACEH_AGE "age" +void InitAGESqlPluginHookIfNeeded() +{ + if (get_extension_oid(APACEH_AGE, true) != InvalidOid && IsFileExisted(APACEH_AGE)) { + load_file(APACEH_AGE, !superuser()); + } +} + #define INIT_PLUGIN_OBJECT "init_plugin_object" #define WHALE "whale" #define DOLPHIN "dolphin" @@ -7735,6 +7743,11 @@ void LoadSqlPlugin() } else if (u_sess->proc_cxt.MyDatabaseId != InvalidOid && DB_IS_CMPT(A_FORMAT) && u_sess->attr.attr_sql.whale) { InitASqlPluginHookIfNeeded(); } + + /* load age if the age extension been created and the age.o file exists */ + if(u_sess->proc_cxt.MyDatabaseId != InvalidOid ){ + InitAGESqlPluginHookIfNeeded(); + } } #endif