postgres

package
v0.0.0-...-e6c4605 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package postgres provides the PostgreSQL SQL dialect definition. This package is pure Go with no database driver dependencies.

Package postgres provides the PostgreSQL SQL dialect definition. This package is pure Go with no database driver dependencies, making it suitable for use in the LSP and other tools that need dialect information without the overhead of database connections.

Index

Constants

This section is empty.

Variables

View Source
var Config = &core.DialectConfig{
	Name:          "postgres",
	DefaultSchema: "public",
	Placeholder:   core.PlaceholderDollar,
	Identifiers: core.IdentifierConfig{
		Quote:         `"`,
		QuoteEnd:      `"`,
		Escape:        `""`,
		Normalization: core.NormLowercase,
	},

	SupportsIlike:        true,
	SupportsCastOperator: true,
	SupportsReturning:    true,

	Aggregates: []string{

		"SUM", "COUNT", "AVG", "MIN", "MAX",
		"STDDEV", "STDDEV_POP", "STDDEV_SAMP",
		"VARIANCE", "VAR_POP", "VAR_SAMP",

		"ARRAY_AGG", "STRING_AGG",
		"JSONB_AGG", "JSONB_OBJECT_AGG", "JSON_AGG", "JSON_OBJECT_AGG",
		"BOOL_AND", "BOOL_OR", "EVERY",
		"BIT_AND", "BIT_OR", "BIT_XOR",
		"CORR", "COVAR_POP", "COVAR_SAMP",
		"REGR_AVGX", "REGR_AVGY", "REGR_COUNT", "REGR_INTERCEPT",
		"REGR_R2", "REGR_SLOPE", "REGR_SXX", "REGR_SXY", "REGR_SYY",
		"PERCENTILE_CONT", "PERCENTILE_DISC",
		"MODE",
		"XMLAGG",
	},
	Generators: []string{

		"CURRENT_TIMESTAMP", "CURRENT_DATE", "CURRENT_TIME",
		"NOW", "LOCALTIME", "LOCALTIMESTAMP",
		"STATEMENT_TIMESTAMP", "TRANSACTION_TIMESTAMP", "CLOCK_TIMESTAMP",

		"GEN_RANDOM_UUID",
		"RANDOM", "SETSEED",

		"PI",

		"CURRENT_SCHEMA", "CURRENT_SCHEMAS",
		"CURRENT_DATABASE", "CURRENT_CATALOG",
		"CURRENT_USER", "CURRENT_ROLE", "SESSION_USER", "USER",
		"VERSION",
		"INET_CLIENT_ADDR", "INET_CLIENT_PORT",
		"INET_SERVER_ADDR", "INET_SERVER_PORT",
		"PG_BACKEND_PID", "PG_BLOCKING_PIDS",
		"TXID_CURRENT", "TXID_CURRENT_IF_ASSIGNED",
	},
	Windows: []string{

		"ROW_NUMBER", "RANK", "DENSE_RANK", "NTILE",
		"PERCENT_RANK", "CUME_DIST",

		"LAG", "LEAD", "FIRST_VALUE", "LAST_VALUE", "NTH_VALUE",
	},
}

Config is the PostgreSQL dialect configuration. This is pure data - accessible by both Adapter and Parser. The Builder reads feature flags and auto-wires standard capabilities.

View Source
var Postgres = dialect.New(Config).
	Clauses(dialect.StandardSelectClauses...).
	Operators(dialect.ANSIOperators).
	JoinTypes(dialect.ANSIJoinTypes).
	WithReservedWords(postgresReservedWords...).
	Build()

Postgres is the PostgreSQL dialect. Builder reads Config flags and auto-wires standard features: - ILIKE operator (SupportsIlike) - :: cast operator (SupportsCastOperator) - RETURNING clause (SupportsReturning)

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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