risingwavelabs/risingwave · error · ResolveRegclassError

resolve qualified name error

Error message

resolve qualified name error: {0}

What it means

This error is produced when parsing or resolving a qualified object name fails inside the regclass-style cast implementation. `ResolveRegclassError::ResolveQualifiedName` wraps `ResolveQualifiedNameError` via `#[from]` and surfaces as "resolve qualified name error: {0}". It indicates the identifier string (e.g. `'schema.table'`) could not be split/qualified into catalog components such as database, schema, and object name.

Solutions

  1. Fix the identifier syntax: quote each part separately, e.g. `nextval('"my schema".my_seq')` instead of mixing dots and quotes incorrectly.
  2. Remove extra components — qualify with at most `[schema].[object]`, not `[database].[schema].[object]`.
  3. Verify the schema part exists (`SHOW SCHEMAS`) and that the search_path matches expectations.
  4. If the name came from application code, log and validate the identifier string before interpolating it into SQL.

Example fix

-- before
SELECT 'mydb.public.my_seq'::regclass;
-- after
SELECT 'public.my_seq'::regclass;
Defensive patterns

Strategy: validation

Validate before calling

// validate identifier before passing it to name resolution
fn is_valid_qualified_name(s: &str) -> bool {
    let parts: Vec<&str> = s.split('.').collect();
    (1..=2).contains(&parts.len()) && parts.iter().all(|p| !p.is_empty())
}

Try / catch

match try_resolve_qualified_name(input) {
    Ok(qn) => proceed(qn),
    Err(ExprError::ResolveQualifiedName(e)) => Err(user_facing("invalid object name: {input}")),
    Err(e) => Err(e),
}

Prevention

When it happens

Trigger: Passing a malformed or unresolvable qualified name to expressions that resolve names to catalog ids, e.g. `'foo.bar.baz.qux'::regclass` with too many parts, illegal identifier characters, or a name whose schema component does not resolve in the current database.

Common situations: Quoting mistakes (mixing single and double quotes), extra dots in the identifier, using an unquoted reserved word as a schema/table name, or copying a fully qualified name including the database prefix from another system where such qualification is valid but is not here.

Understand the failure class

Background: "invalid id" errors: invalid identifier format — why libraries reject IDs before lookup, and how to fix them — this error's family across 37 libraries.

Related errors


AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11). Data as JSON: /api/errors/b2c71c50ba99af4d. Report an issue: GitHub.

Appendix: source

Thrown at src/frontend/src/expr/function_impl/cast_regclass.rs:35

use risingwave_expr::{ExprError, capture_context, function};
use risingwave_sqlparser::parser::{Parser, ParserError};
use thiserror::Error;
use thiserror_ext::AsReport;

use super::context::{AUTH_CONTEXT, CATALOG_READER, DB_NAME, SEARCH_PATH};
use crate::Binder;
use crate::binder::ResolveQualifiedNameError;
use crate::catalog::root_catalog::SchemaPath;
use crate::catalog::{CatalogError, CatalogReader};
use crate::session::AuthContext;

#[derive(Error, Debug)]
enum ResolveRegclassError {
    #[error("parse object name failed: {0}")]
    Parser(#[from] ParserError),
    #[error("catalog error: {0}")]
    Catalog(#[from] CatalogError),
    #[error("resolve qualified name error: {0}")]
    ResolveQualifiedName(#[from] ResolveQualifiedNameError),
}

impl From<ResolveRegclassError> for ExprError {
    fn from(e: ResolveRegclassError) -> Self {
        match e {
            ResolveRegclassError::Parser(e) => ExprError::Parse(e.to_report_string().into()),
            ResolveRegclassError::Catalog(e) => ExprError::InvalidParam {
                name: "name",
                reason: e.to_report_string().into(),
            },
            ResolveRegclassError::ResolveQualifiedName(e) => ExprError::InvalidParam {
                name: "name",
                reason: e.to_report_string().into(),
            },
        }
    }
}

View on GitHub (pinned to 6469eb736d)