Rename internal introspection tables. Fix warning notifications from RefreshConnections. Improve error handlingh for config inconsistencies in conneciton and plugin config. Closes #3886

This commit is contained in:
kaidaguerre
2023-09-22 16:02:41 +01:00
committed by GitHub
parent 0581cca289
commit 79606c5bcd
88 changed files with 1378 additions and 762 deletions

View File

@@ -11,14 +11,14 @@ import (
func GetPluginTableCreateSql() db_common.QueryWithArgs {
return db_common.QueryWithArgs{
Query: fmt.Sprintf(`CREATE TABLE IF NOT EXISTS %s.%s (
plugin TEXT NOT NULL,
plugin_instance TEXT NULL,
max_memory_mb INTEGER,
rate_limiters JSONB NULL,
plugin TEXT NOT NULL,
memory_max_mb INTEGER,
limiters JSONB NULL,
file_name TEXT,
start_line_number INTEGER,
end_line_number INTEGER
);`, constants.InternalSchema, constants.PluginConfigTable),
);`, constants.InternalSchema, constants.PluginInstanceTable),
}
}
@@ -27,17 +27,17 @@ func GetPluginTablePopulateSql(plugin *modconfig.Plugin) db_common.QueryWithArgs
Query: fmt.Sprintf(`INSERT INTO %s.%s (
plugin,
plugin_instance,
max_memory_mb,
rate_limiters,
memory_max_mb,
limiters,
file_name,
start_line_number,
end_line_number
)
VALUES($1,$2,$3,$4,$5,$6,$7)`, constants.InternalSchema, constants.PluginConfigTable),
VALUES($1,$2,$3,$4,$5,$6,$7)`, constants.InternalSchema, constants.PluginInstanceTable),
Args: []any{
plugin.Plugin,
plugin.Instance,
plugin.MaxMemoryMb,
plugin.MemoryMaxMb,
plugin.Limiters,
plugin.FileName,
plugin.StartLineNumber,
@@ -51,7 +51,7 @@ func GetPluginTableDropSql() db_common.QueryWithArgs {
Query: fmt.Sprintf(
`DROP TABLE IF EXISTS %s.%s;`,
constants.InternalSchema,
constants.PluginConfigTable,
constants.PluginInstanceTable,
),
}
}
@@ -61,7 +61,7 @@ func GetPluginTableGrantSql() db_common.QueryWithArgs {
Query: fmt.Sprintf(
`GRANT SELECT ON TABLE %s.%s to %s;`,
constants.InternalSchema,
constants.PluginConfigTable,
constants.PluginInstanceTable,
constants.DatabaseUsersRole,
),
}