Documentation
¶
Overview ¶
Package postgres implements the PostgreSQL dialect driver. This file is the lexer profile: token boundaries only, no SQL understanding.
Index ¶
- type Frontend
- func (Frontend) Parse(sql string) (dialect.Tree, error)
- func (f Frontend) ProbeExpr(expr string) error
- func (f Frontend) ProbeGroupBy(clause string) error
- func (f Frontend) ProbeInsertValue(expr string) error
- func (f Frontend) ProbeJoinItem(item string) error
- func (f Frontend) ProbeOrderBy(clause string) error
- func (f Frontend) ProbeOrderByKey(expr string) error
- func (f Frontend) ProbeSetItem(item string) error
- type Oracle
- func (o *Oracle) Describe(ctx context.Context, sql string) (dialect.Desc, error)
- func (o *Oracle) Plan(ctx context.Context, sql string) error
- func (o *Oracle) PlanText(ctx context.Context, sql string) (string, error)
- func (o *Oracle) ServerVersion(ctx context.Context) (string, error)
- func (o *Oracle) Snapshot(ctx context.Context) (*cache.Catalog, error)
- type Profile
- type TypeMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Frontend ¶
type Frontend struct{}
Frontend is the pg_query-backed grammar frontend (design 02 §3).
func (Frontend) ProbeExpr ¶
ProbeExpr checks that expr forms exactly one boolean-position expression: it must parse when parenthesized as a WHERE qual. Balance of parentheses is the caller's (rules') concern via the lexer; parse failure here means the body is not one expression.
func (Frontend) ProbeGroupBy ¶
ProbeGroupBy checks that clause is exactly one statement-level GROUP BY clause and nothing more.
func (Frontend) ProbeInsertValue ¶
ProbeInsertValue checks that expr is exactly one VALUES row item (including the DEFAULT keyword, which is only legal there).
func (Frontend) ProbeJoinItem ¶
ProbeJoinItem checks that item is a join item attachable to a preceding FROM entry: `SELECT 1 FROM sqletch_probe_t <item>` must parse into exactly one FROM tree and contribute nothing else.
func (Frontend) ProbeOrderBy ¶
ProbeOrderBy checks that clause is exactly one statement-level ORDER BY clause and nothing more.
func (Frontend) ProbeOrderByKey ¶
ProbeOrderByKey checks that expr is exactly one sort key.
func (Frontend) ProbeSetItem ¶
ProbeSetItem checks that item is exactly one UPDATE SET assignment.
type Oracle ¶
type Oracle struct {
// contains filtered or unexported fields
}
Oracle is the server-backed PostgreSQL type oracle: it lets the database itself be the type checker via the extended protocol's Parse/Describe. See docs/design/04-type-oracle.md.
func (*Oracle) Plan ¶
Plan surfaces planner-stage errors invisible to prepare. GENERIC_PLAN (PostgreSQL 16+) plans a parameterized statement without values — exactly the shape-verification need.
type Profile ¶
type Profile struct{}
func (Profile) PlaceholderStyle ¶
func (Profile) PlaceholderStyle() dialect.PlaceholderStyle
PlaceholderStyle declares PostgreSQL's numbered-with-reuse binding.
type TypeMap ¶
type TypeMap struct{}
TypeMap maps PostgreSQL type OIDs to Go types for generated code. Deliberately conservative: unmapped types are a compile error (SQLETCH311) with the type name in the message — never a silent guess. Extensions require checking that pgx can Scan/Encode the Go type for that OID.
func (TypeMap) TypeByName ¶
TypeByName resolves a SQL type name from a `-- @param` hint.