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 ¶
SubstituteDecodedParams replaces $1, $2, ... placeholders with pre-decoded string values. "NULL" values are substituted unquoted; all other values are single-quote escaped.
func SubstituteParams ¶
SubstituteParams replaces $1, $2, ... placeholders with their bound values. NULL parameters (nil entries in paramValues) are substituted as the literal NULL. String values are single-quote escaped.
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.