import { DataTypeMap } from './dataTypeMap.js'; import { SQLDialect, DatabasePlatform, LimitClauseResult, SchemaIntrospectionSQL, TriggerOptions, IndexOptions, ColumnDDLOptions, AlterColumnOptions, ResolveTypeOptions } from './sqlDialect.js'; /** * PostgreSQL dialect implementation. * Uses "double-quote" identifiers, LIMIT/OFFSET pagination, native BOOLEAN, PL/pgSQL functions. */ export declare class PostgreSQLDialect extends SQLDialect { get PlatformKey(): DatabasePlatform; get ParserDialect(): string; /** * PostgreSQL has no in-row row-size limit (TOAST stores oversized variable-length values * out-of-line), so {@link MaxInRowSizeBytes} stays `null` (inherited). It does enforce a * hard 1600-column-per-table cap. */ get MaxColumnCount(): number; QuoteIdentifier(name: string): string; QuoteSchema(schema: string, object: string): string; /** * PostgreSQL folds unquoted identifiers to lowercase, which would turn * `AS EntityName` into the result column `entityname`. Quoting the * alias preserves the requested casing for callers that key off the * column name (e.g. when consuming results into a TypeScript object * with a PascalCase property). */ QuoteColumnAlias(aliasName: string): string; /** * PostgreSQL folds unquoted identifiers to lowercase, so the physical schema an * unquoted `CREATE SCHEMA __mj_BizAppsCommon` produces is `__mj_bizappscommon`. * Canonicalize to that lowercase form so the engine's quoted operations target the * same physical schema as the app's (typically unquoted) migration DDL. */ CanonicalSchemaName(name: string): string; LimitClause(limit: number, offset?: number): LimitClauseResult; BooleanLiteral(value: boolean): string; BooleanParameterType(): string; /** * PostgreSQL has no `ISNULL` keyword; the standard is `COALESCE` (which * SQL Server also supports). PG generated SPs/functions emit COALESCE * everywhere a null-coalescing wrap is needed. */ IsNull(expr: string, fallback: string): string; /** * PostgreSQL's n-ary null-coalescing is also `COALESCE`. Same form as * the two-arg `IsNull` since PG has no `ISNULL` to differentiate from. */ Coalesce(expr: string, fallback: string): string; /** * PostgreSQL function parameters use a `p_` convention * (no `@`-prefix syntax in PG). This matches the baseline-ported SP names * (which lowercased SQL Server's PascalCase parameter names without * separators — e.g. `@CompanyID` → `p_companyid`) and the runtime * PostgreSQLDataProvider, which calls procs with `p_${field.Name.toLowerCase()}`. * * Earlier this used a snake_case transform (`p_company_id`), which * produced functions the runtime could never invoke. Underscores already * in the input (e.g. the `_Clear` companion suffix) are preserved. */ ParameterRef(name: string): string; /** * PostgreSQL functions use the `DEFAULT ` clause for parameter defaults. */ ParameterDefault(value: string): string; CurrentTimestampUTC(): string; private static readonly _BooleanTypeNames; private static readonly _StringTypeNames; /** * PG fixed-width / space-padded char types. `character` (without `varying`) * and `bpchar` are the formal/internal names; `char` is the short alias. * Note: `character varying` is NOT included — it's variable-width. */ private static readonly _FixedWidthStringTypeNames; private static readonly _DateTypeNames; private static readonly _IntegerTypeNames; private static readonly _FloatTypeNames; private static readonly _UuidTypeNames; private static readonly _BinaryTypeNames; private static readonly _JsonTypeNames; private static readonly _CurrencyTypeNames; private static readonly _IntervalTypeNames; private static readonly _NetworkTypeNames; get BooleanTypeNames(): readonly string[]; get StringTypeNames(): readonly string[]; get FixedWidthStringTypeNames(): readonly string[]; get DateTypeNames(): readonly string[]; get IntegerTypeNames(): readonly string[]; get FloatTypeNames(): readonly string[]; get UuidTypeNames(): readonly string[]; get BinaryTypeNames(): readonly string[]; get JsonTypeNames(): readonly string[]; get CurrencyTypeNames(): readonly string[]; get IntervalTypeNames(): readonly string[]; get NetworkTypeNames(): readonly string[]; NewUUID(): string; CastToText(expr: string): string; /** * PostgreSQL-specific Flyway escape. PostgreSQL string concatenation uses * `||` (not `+`), and TEXT has no length cap — so a simple split with `||` * suffices and no cast-to-MAX dance is needed (unlike SQL Server, which * silently truncates `NVARCHAR(N) + NVARCHAR(M)` past 4,000 chars). * PostgreSQL string literals don't take an `N` prefix either; everything * is already Unicode. */ EscapeFlywayStringInterpolation(sql: string): string; CastToUUID(expr: string): string; /** * PostgreSQL strict typing requires an explicit `::UUID` cast when * comparing the empty-GUID sentinel against a UUID-typed column. * Without it, PG raises "operator does not exist: uuid = text". */ EmptyUUIDLiteral(): string; ReturnInsertedClause(columns?: string[]): string; AutoIncrementPKExpression(): string; UUIDPKDefault(): string; ScopeIdentityExpression(): string; RowCountExpression(): string; BatchSeparator(): string; /** * Splits an oversized SQL batch into individual statements on `;`+EOL * boundaries — but NEVER inside a PostgreSQL dollar-quoted block * (`$$ … $$` or `$tag$ … $tag$`), whose body legitimately contains * `;`+newline (DO blocks, PL/pgSQL function bodies, the integration * view-drop guard `$mj_dropviews$`). A naive `split(/;\s*\n/g)` tears * those apart. Outside dollar blocks the boundary semantics mirror the * base `split(/;\s*\n/g)` (a `;` then optional inline whitespace then a * newline). Each returned statement ends with `;`. */ SplitStatements(batch: string): string[]; ExistenceCheckSQL(objectType: string, schema: string, name: string): string; CreateOrReplaceSupported(objectType: string): boolean; FullTextSearchPredicate(column: string, searchTerm: string): string; FullTextIndexDDL(table: string, columns: string[], _catalog?: string): string; RecursiveCTESyntax(): string; get AllowsOrderByInCTE(): boolean; get DefaultPagingOrderBy(): string; get TypeMap(): DataTypeMap; ParameterPlaceholder(index: number): string; ConcatOperator(): string; StringSplitFunction(value: string, delimiter: string): string; JsonExtract(column: string, path: string): string; ProcedureCallSyntax(schema: string, name: string, params: string[]): string; CreateSchemaDDL(schemaName: string): string; DateAddExpression(unit: 'MINUTE' | 'HOUR' | 'DAY', amount: number, baseExpr: string): string; CreateTableIfNotExistsDDL(schema: string, tableName: string, columnsDDL: string): string; ConditionalBlock(condition: string, thenSQL: string, elseSQL?: string): string; RaiseSignalSQL(message: string): string; AddColumnClause(col: ColumnDDLOptions): string; AlterColumnDDL(quotedTable: string, options: AlterColumnOptions): string; CommentOnColumn(schema: string, table: string, column: string, comment: string): string; FallbackType(): string; TriggerDDL(options: TriggerOptions): string; IndexDDL(options: IndexOptions): string; GrantPermission(permission: string, _objectType: string, schema: string, object: string, role: string): string; CommentOnObject(objectType: string, schema: string, name: string, comment: string): string; SchemaIntrospectionQueries(): SchemaIntrospectionSQL; /** * PostgreSQL FK-graph query for cascade planning — reads `pg_catalog.pg_constraint` * (`contype = 'f'`). Returns one row per FK column (via `unnest(conkey, confkey)`, which * preserves column pairing/order), with `childNullable` (`NOT attnotnull`) and `colCount` * (`array_length(conkey, 1)`, for composite exclusion). Column aliases and semantics MATCH * the SQL Server variant so a single caller parses both. `relname`/`attname` preserve the * quoted mixed-case identifiers MJ creates on PG, so they feed straight into QuoteIdentifier. * Both parent + child are filtered to `schema`; the schema is embedded as a literal. */ ForeignKeyGraphSQL(schema: string): string; AtomicBatchScript(statements: string[]): string; IIF(condition: string, trueVal: string, falseVal: string): string; ResolveAbstractType(options: ResolveTypeOptions): string; private resolveStringType; IsConnectionError(e: unknown): boolean; private extractSchema; private extractName; } //# sourceMappingURL=postgresqlDialect.d.ts.map