Tencent/WeKnora · error
access to schema '%s' is not allowed
Error message
access to schema '%s' is not allowed
What it means
Schema-access guard in validateFromItem: the FROM item is schema-qualified and schema access checking is enabled, but the qualifier is not 'public'. The validator rejects any non-public schema to keep queries inside the permitted namespace.
Source
Thrown at internal/utils/inject.go:1430
return nil
}
// validateFromItem validates a FROM clause item
func (v *sqlValidator) validateFromItem(node *pg_query.Node, tables map[string]string, result *SQLValidationResult) error {
if node == nil {
return nil
}
// Handle RangeVar (simple table reference)
if rv := node.GetRangeVar(); rv != nil {
tableName := strings.ToLower(rv.Relname)
// Check for schema qualification
if v.checkSchemaAccess && rv.Schemaname != "" {
schemaName := strings.ToLower(rv.Schemaname)
if schemaName != "public" {
return fmt.Errorf("access to schema '%s' is not allowed", rv.Schemaname)
}
}
// Get alias
alias := tableName
if rv.Alias != nil && rv.Alias.Aliasname != "" {
alias = strings.ToLower(rv.Alias.Aliasname)
}
tables[tableName] = alias
return nil
}
// Handle JoinExpr (JOIN)
if je := node.GetJoinExpr(); je != nil {
if err := v.validateFromItem(je.Larg, tables, result); err != nil {
return err
}
if err := v.validateFromItem(je.Rarg, tables, result); err != nil {View on GitHub (pinned to 988cbb0330)
Solutions
- Rewrite the query without a schema qualifier so it resolves in public
- Use only tables exposed in the public schema
- Remove pg_catalog / system schema references
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at internal/utils/inject.go:1430 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02).
Data as JSON: /api/errors/ce63c7aa2b8a703c.
Report an issue: GitHub.