Skip to main content

run_namespace_prelude

Function run_namespace_prelude 

Source
async fn run_namespace_prelude(
    db: &GreptimeDB,
    namespace: &str,
    query_ctx: &QueryContext,
) -> Result<(), String>
Expand description

Execute the namespace prelude (CREATE DATABASE IF NOT EXISTS + USE) for a case. This is NOT written into verify.result.

The prelude is protocol-aware:

  • CREATE DATABASE is always sent via gRPC so it works regardless of statement-level protocol directives.
  • For Postgres-protocol statements, SET search_path selects the case namespace instead of running USE (which is not valid PG SQL).
  • For MySQL and default/gRPC statements, USE <ns> runs through the statement’s effective context.