Add warnings to user-callable functions

This commit is contained in:
Adam Guo 2025-03-04 22:13:46 +00:00
parent 6d1646db7a
commit 7f71f7c5e7

View file

@ -191,6 +191,8 @@ create_immv(PG_FUNCTION_ARGS)
CreateTableAsStmt *ctas; CreateTableAsStmt *ctas;
StringInfoData command_buf; StringInfoData command_buf;
warnIfPgIvmNotPreloaded();
parseNameAndColumns(relname, &names, &colNames); parseNameAndColumns(relname, &names, &colNames);
initStringInfo(&command_buf); initStringInfo(&command_buf);
@ -250,6 +252,8 @@ refresh_immv(PG_FUNCTION_ARGS)
QueryCompletion qc; QueryCompletion qc;
StringInfoData command_buf; StringInfoData command_buf;
warnIfPgIvmNotPreloaded();
initStringInfo(&command_buf); initStringInfo(&command_buf);
appendStringInfo(&command_buf, "SELECT refresh_immv('%s, %s);", appendStringInfo(&command_buf, "SELECT refresh_immv('%s, %s);",
relname, ispopulated ? "true" : "false"); relname, ispopulated ? "true" : "false");
@ -364,6 +368,8 @@ get_immv_def(PG_FUNCTION_ARGS)
Query *query = NULL; Query *query = NULL;
char *querystring = NULL; char *querystring = NULL;
warnIfPgIvmNotPreloaded();
/* Make sure IMMV is a table. */ /* Make sure IMMV is a table. */
if (get_rel_relkind(matviewOid) != RELKIND_RELATION) if (get_rel_relkind(matviewOid) != RELKIND_RELATION)
PG_RETURN_NULL(); PG_RETURN_NULL();