queryshape

package
v1.1.959 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2026 License: MIT Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package queryshape provides result column metadata inference for SQL queries without executing them.

Type inference sources vary by relation kind:

  • Materialized views and user space tables: column metadata is stored alongside the DDL in system tables (__iql__.materialized_views.columns, __iql__.tables.columns). OIDs, widths, and types are directly available.

  • Views: the view DDL (a SELECT) is stored in __iql__.views. Parsing the DDL and recursively analysing the projection list yields column shapes. This currently delegates to the plan builder.

  • Direct queries and subqueries: column types are a function of provider method schemas, applied SQL function signatures, and RDBMS expression rules. This currently delegates to the plan builder.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SubstituteDecodedParams

func SubstituteDecodedParams(query string, decodedValues []paramdecoder.DecodedParam) string

SubstituteDecodedParams replaces $1, $2, ... placeholders with their decoded values as string literals; null parameters become NULL. The query is scanned with the parser's own tokenizer, so a $n inside a string literal, quoted identifier or comment is left alone.

Types

type Inferrer

type Inferrer interface {
	// InferResultColumns returns wire-protocol column metadata for the
	// given query.  Returns nil when columns cannot be derived (DDL,
	// mutations, planning failures).
	InferResultColumns(query string) []sqldata.ISQLColumn
}

Inferrer analyses SQL queries and returns result column metadata without executing them.

func NewInferrer

func NewInferrer(handlerCtx handler.HandlerContext) Inferrer

NewInferrer creates a new query shape inferrer backed by the given handler context.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL