pgsql-deparser 16.0.0 → 17.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/README.md +45 -88
  2. package/deparser.d.ts +297 -0
  3. package/{deparser/deparser.js → deparser.js} +110 -435
  4. package/esm/{deparser/deparser.js → deparser.js} +110 -435
  5. package/esm/index.js +3 -15
  6. package/esm/utils/index.js +90 -0
  7. package/esm/{deparser/utils → utils}/list-utils.js +0 -4
  8. package/esm/{deparser/utils → utils}/quote-utils.js +0 -34
  9. package/esm/utils/sql-formatter.js +23 -0
  10. package/esm/{deparser/visitors → visitors}/base.js +0 -4
  11. package/index.d.ts +3 -9
  12. package/index.js +4 -16
  13. package/package.json +27 -14
  14. package/utils/index.d.ts +4 -0
  15. package/utils/index.js +97 -0
  16. package/{deparser/utils → utils}/list-utils.d.ts +0 -4
  17. package/{deparser/utils → utils}/list-utils.js +0 -4
  18. package/utils/quote-utils.d.ts +5 -0
  19. package/{deparser/utils → utils}/quote-utils.js +0 -34
  20. package/{deparser/utils → utils}/sql-formatter.d.ts +1 -7
  21. package/{deparser/utils → utils}/sql-formatter.js +2 -15
  22. package/{deparser/visitors → visitors}/base.d.ts +5 -8
  23. package/{deparser/visitors → visitors}/base.js +0 -4
  24. package/deparser/deparser.d.ts +0 -301
  25. package/deparser/index.d.ts +0 -9
  26. package/deparser/index.js +0 -17
  27. package/deparser/utils/quote-utils.d.ts +0 -24
  28. package/esm/deparser/index.js +0 -13
  29. package/esm/deparser/utils/sql-formatter.js +0 -36
  30. package/esm/v16-to-v17-direct.js +0 -44
  31. package/esm/v16-to-v17.js +0 -1488
  32. package/v16-to-v17-direct.d.ts +0 -21
  33. package/v16-to-v17-direct.js +0 -48
  34. package/v16-to-v17.d.ts +0 -638
  35. package/v16-to-v17.js +0 -1492
package/README.md CHANGED
@@ -14,7 +14,7 @@
14
14
  <a href="https://www.npmjs.com/package/pgsql-deparser"><img height="20" src="https://img.shields.io/github/package-json/v/launchql/pgsql-parser?filename=packages%2Fdeparser%2Fpackage.json"/></a>
15
15
  </p>
16
16
 
17
- `pgsql-deparser` is the lightning-fast, pure TypeScript solution for converting PostgreSQL ASTs back into SQL queries. Perfect companion to [`pgsql-parser`](https://github.com/launchql/pgsql-parser), this focused tool delivers SQL generation without any native dependencies or WebAssembly overhead.
17
+ `pgsql-deparser` is a streamlined tool designed to convert PostgreSQL Abstract Syntax Trees (AST) back into SQL queries. It is a companion module to [`pgsql-parser`](https://github.com/launchql/pgsql-parser), which is capable of both parsing SQL queries into ASTs and deparsing these ASTs back into SQL. However, unlike `pgsql-parser`, which incorporates the full PostgreSQL parser, `pgsql-deparser` focuses solely on the deparser functionality. This makes it an excellent choice for scenarios where only AST-to-SQL conversion is needed, avoiding the extra overhead associated with the full parsing capabilities.
18
18
 
19
19
  ## Installation
20
20
 
@@ -22,12 +22,11 @@
22
22
  npm install pgsql-deparser
23
23
  ```
24
24
 
25
- ## Features
25
+ ## Key Features
26
26
 
27
- * **Pure TypeScript Performance** Zero runtime dependencies, no WASM, no compilation - just blazing fast SQL generation
28
- * 🪶 **Ultra Lightweight** Minimal footprint with laser-focused functionality for AST-to-SQL conversion only
29
- * 🧪 **Battle-Tested Reliability** Validated against 23,000+ SQL statements ensuring production-grade stability
30
- * 🌍 **Universal Compatibility** – Runs anywhere JavaScript does - browsers, Node.js, edge functions, you name it
27
+ - **Lightweight and Pure TypeScript**: Built entirely in TypeScript, `pgsql-deparser` is lightweight and doesn't rely on native dependencies, facilitating easier integration and deployment across various environments.
28
+ - **Focused Functionality**: By concentrating on decompiling ASTs to SQL, `pgsql-deparser` offers a specialized, efficient solution for those who need to generate SQL statements from ASTs without the full parsing mechanism.
29
+ - **Compatibility**: Ideal for use cases where the AST is already obtained from another source or process, allowing for seamless SQL generation from AST representations.
31
30
 
32
31
  ## Deparser Example
33
32
 
@@ -36,21 +35,20 @@ The `pgsql-deparser` module serializes ASTs to SQL in pure TypeScript, avoiding
36
35
  Here's how you can use the deparser in your TypeScript code, using [`@pgsql/utils`](https://github.com/launchql/pgsql-parser/tree/main/packages/utils) to create an AST for `deparse`:
37
36
 
38
37
  ```ts
39
- import * as t from '@pgsql/utils';
40
- import { RangeVar, SelectStmt } from '@pgsql/types';
41
- import { deparseSync as deparse } from 'pgsql-deparser';
38
+ import ast, { SelectStmt } from '@pgsql/utils';
39
+ import { deparse } from 'pgsql-deparser';
42
40
 
43
41
  // This could have been obtained from any JSON or AST, not necessarily @pgsql/utils
44
- const stmt: { SelectStmt: SelectStmt } = t.nodes.selectStmt({
42
+ const stmt: SelectStmt = ast.selectStmt({
45
43
  targetList: [
46
- t.nodes.resTarget({
47
- val: t.nodes.columnRef({
48
- fields: [t.nodes.aStar()]
44
+ ast.resTarget({
45
+ val: ast.columnRef({
46
+ fields: [ast.aStar()]
49
47
  })
50
48
  })
51
49
  ],
52
50
  fromClause: [
53
- t.nodes.rangeVar({
51
+ ast.rangeVar({
54
52
  relname: 'some_table',
55
53
  inh: true,
56
54
  relpersistence: 'p'
@@ -60,101 +58,60 @@ const stmt: { SelectStmt: SelectStmt } = t.nodes.selectStmt({
60
58
  op: 'SETOP_NONE'
61
59
  });
62
60
 
63
- // Modify the AST if needed
64
- (stmt.SelectStmt.fromClause[0] as {RangeVar: RangeVar}).RangeVar.relname = 'another_table';
61
+ // Modify the AST if needed
62
+ stmt.SelectStmt.fromClause[0].RangeVar.relname = 'another_table';
65
63
 
66
64
  // Deparse the modified AST back to a SQL string
67
- console.log(deparse(stmt));
65
+ console.log(deparse(stmts));
68
66
 
69
67
  // Output: SELECT * FROM another_table
70
68
  ```
71
69
 
72
- ### Latest Version (PostgreSQL 17)
73
-
74
- ```sh
75
- npm install pgsql-deparser
76
- ```
77
-
78
- ### Version-Specific Packages (PostgreSQL 13-16)
79
-
80
- While we highly recommend using PG17, for PostgreSQL versions 13-16, use the version-specific packages:
70
+ ## Why Use `pgsql-deparser`?
81
71
 
82
- ```sh
83
- npm install pgsql-deparser@v13 # PostgreSQL 13
84
- npm install pgsql-deparser@v14 # PostgreSQL 14
85
- npm install pgsql-deparser@v15 # PostgreSQL 15
86
- npm install pgsql-deparser@v16 # PostgreSQL 16
87
- ```
72
+ `pgsql-deparser` is particularly useful in development environments where native dependencies are problematic or in applications where only the deparser functionality is required. Its independence from the full `pgsql-parser` package allows for more focused and lightweight SQL generation tasks.
88
73
 
89
- ## Options
74
+ ## Versions
90
75
 
91
- The deparser accepts optional configuration for formatting and output control:
76
+ As of PG 13, PG majors versions maintained will have a matching dedicated major npm version. Only the latest Postgres stable release receives active updates.
92
77
 
93
- ```ts
94
- import { deparseSync as deparse } from 'pgsql-deparser';
78
+ Our latest is built with `13-latest` branch from libpg_query
95
79
 
96
- const options = {
97
- pretty: true, // Enable pretty formatting (default: false)
98
- newline: '\n', // Newline character (default: '\n')
99
- tab: ' ', // Tab/indentation character (default: ' ')
100
- semicolons: true // Add semicolons to statements (default: true)
101
- };
80
+ | PostgreSQL Major Version | libpg_query | Status | npm
81
+ |--------------------------|-------------|---------------------|---------|
82
+ | 13 | 13-latest | Active development | `latest`
83
+ | 12 | (n/a) | Not supported |
84
+ | 11 | (n/a) | Not supported |
85
+ | 10 | 10-latest | Not supported | `@1.3.1` ([tree](https://github.com/launchql/pgsql-parser/tree/39b7b1adc8914253226e286a48105785219a81ca)) |
102
86
 
103
- const sql = deparse(ast, options);
104
- ```
105
87
 
106
- | Option | Type | Default | Description |
107
- |--------|------|---------|-------------|
108
- | `pretty` | `boolean` | `false` | Enable pretty formatting with indentation and line breaks |
109
- | `newline` | `string` | `'\n'` | Character(s) used for line breaks |
110
- | `tab` | `string` | `' '` | Character(s) used for indentation |
111
- | `semicolons` | `boolean` | `true` | Add semicolons to SQL statements |
88
+ ## Related
112
89
 
113
- **Pretty formatting example:**
114
- ```ts
115
- // Without pretty formatting
116
- const sql1 = deparse(selectAst, { pretty: false });
117
- // "SELECT id, name FROM users WHERE active = true;"
118
-
119
- // With pretty formatting
120
- const sql2 = deparse(selectAst, { pretty: true });
121
- // SELECT
122
- // id,
123
- // name
124
- // FROM users
125
- // WHERE
126
- // active = true;
127
- ```
90
+ * [pgsql-parser](https://github.com/launchql/pgsql-parser): The real PostgreSQL parser for Node.js, providing symmetric parsing and deparsing of SQL statements with actual PostgreSQL parser integration.
91
+ * [pgsql-deparser](https://github.com/launchql/pgsql-parser/tree/main/packages/deparser): A streamlined tool designed for converting PostgreSQL ASTs back into SQL queries, focusing solely on deparser functionality to complement `pgsql-parser`.
92
+ * [pgsql-enums](https://github.com/launchql/pgsql-parser/tree/main/packages/pgsql-enums): A utility package offering easy access to PostgreSQL enumeration types in JSON format, aiding in string and integer conversions of enums used within ASTs to compliment `pgsql-parser`
93
+ * [@pgsql/enums](https://github.com/launchql/pgsql-parser/tree/main/packages/enums): Provides PostgreSQL AST enums in TypeScript, enhancing type safety and usability in projects interacting with PostgreSQL AST nodes.
94
+ * [@pgsql/types](https://github.com/launchql/pgsql-parser/tree/main/packages/types): Offers TypeScript type definitions for PostgreSQL AST nodes, facilitating type-safe construction, analysis, and manipulation of ASTs.
95
+ * [@pgsql/utils](https://github.com/launchql/pgsql-parser/tree/main/packages/utils): A comprehensive utility library for PostgreSQL, offering type-safe AST node creation and enum value conversions, simplifying the construction and manipulation of PostgreSQL ASTs.
96
+ * [pg-proto-parser](https://github.com/launchql/pg-proto-parser): A TypeScript tool that parses PostgreSQL Protocol Buffers definitions to generate TypeScript interfaces, utility functions, and JSON mappings for enums.
97
+ * [libpg-query](https://github.com/launchql/libpg-query-node): The real PostgreSQL parser exposed for Node.js, used primarily in `pgsql-parser` for parsing and deparsing SQL queries.
128
98
 
129
- For complete documentation and advanced options, see [DEPARSER_USAGE.md](../../DEPARSER_USAGE.md).
99
+ Thanks [@lfittl](https://github.com/lfittl) for building the core `libpg_query` suite:
130
100
 
131
- ## Why Use `pgsql-deparser`?
132
-
133
- `pgsql-deparser` is particularly useful in development environments where native dependencies are problematic or in applications where only the deparser functionality is required. Its independence from the full `pgsql-parser` package allows for more focused and lightweight SQL generation tasks.
101
+ * [libpg_query](https://github.com/pganalyze/libpg_query)
102
+ * [pg_query](https://github.com/lfittl/pg_query)
103
+ * [pg_query.go](https://github.com/lfittl/pg_query.go)
134
104
 
135
105
  ## Credits
136
106
 
137
- Built on the excellent work of several contributors:
138
-
139
- * **[Dan Lynch](https://github.com/pyramation)** — official maintainer since 2018 and architect of the current implementation
140
- * **[Lukas Fittl](https://github.com/lfittl)** for [libpg_query](https://github.com/pganalyze/libpg_query) — the core PostgreSQL parser that powers this project
141
- * **[Greg Richardson](https://github.com/gregnr)** for AST guidance and pushing the transition to WASM and multiple PG runtimes for better interoperability
142
- * **[Ethan Resnick](https://github.com/ethanresnick)** for the original Node.js N-API bindings
143
- * **[Zac McCormick](https://github.com/zhm)** for the foundational [node-pg-query-native](https://github.com/zhm/node-pg-query-native) parser
107
+ Thanks to [@zhm](https://github.com/zhm) for the OG parser that started it all:
144
108
 
145
- ## Related
146
-
147
- * [pgsql-parser](https://www.npmjs.com/package/pgsql-parser): The real PostgreSQL parser for Node.js, providing symmetric parsing and deparsing of SQL statements with actual PostgreSQL parser integration.
148
- * [pgsql-deparser](https://www.npmjs.com/package/pgsql-deparser): A streamlined tool designed for converting PostgreSQL ASTs back into SQL queries, focusing solely on deparser functionality to complement `pgsql-parser`.
149
- * [@pgsql/parser](https://www.npmjs.com/package/@pgsql/parser): Multi-version PostgreSQL parser with dynamic version selection at runtime, supporting PostgreSQL 15, 16, and 17 in a single package.
150
- * [@pgsql/types](https://www.npmjs.com/package/@pgsql/types): Offers TypeScript type definitions for PostgreSQL AST nodes, facilitating type-safe construction, analysis, and manipulation of ASTs.
151
- * [@pgsql/enums](https://www.npmjs.com/package/@pgsql/enums): Provides TypeScript enum definitions for PostgreSQL constants, enabling type-safe usage of PostgreSQL enums and constants in your applications.
152
- * [@pgsql/utils](https://www.npmjs.com/package/@pgsql/utils): A comprehensive utility library for PostgreSQL, offering type-safe AST node creation and enum value conversions, simplifying the construction and manipulation of PostgreSQL ASTs.
153
- * [pg-proto-parser](https://www.npmjs.com/package/pg-proto-parser): A TypeScript tool that parses PostgreSQL Protocol Buffers definitions to generate TypeScript interfaces, utility functions, and JSON mappings for enums.
154
- * [libpg-query](https://github.com/launchql/libpg-query-node): The real PostgreSQL parser exposed for Node.js, used primarily in `pgsql-parser` for parsing and deparsing SQL queries.
109
+ * [pg-query-parser](https://github.com/zhm/pg-query-parser)
110
+ * [pg-query-native](https://github.com/zhm/node-pg-query-native)
111
+ * [Original LICENSE](https://github.com/zhm/pg-query-parser/blob/master/LICENSE.md)
155
112
 
156
113
  ## Disclaimer
157
114
 
158
- AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED "AS IS", AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.
115
+ AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED AS IS”, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.
159
116
 
160
- No developer or entity involved in creating Software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the Software code or Software CLI, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value.
117
+ No developer or entity involved in creating Software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the Software code or Software CLI, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value.
package/deparser.d.ts ADDED
@@ -0,0 +1,297 @@
1
+ import { Node } from '@pgsql/types';
2
+ import { DeparserContext, DeparserVisitor } from './visitors/base';
3
+ import * as t from '@pgsql/types';
4
+ export interface DeparserOptions {
5
+ newline?: string;
6
+ tab?: string;
7
+ functionDelimiter?: string;
8
+ functionDelimiterFallback?: string;
9
+ }
10
+ /**
11
+ * Deparser - Converts PostgreSQL AST nodes back to SQL strings
12
+ *
13
+ * Entry Points:
14
+ * 1. ParseResult (from libpg-query) - The complete parse result
15
+ * Structure: { version: number, stmts: RawStmt[] }
16
+ * Note: stmts is "repeated RawStmt" in protobuf, so array contains RawStmt
17
+ * objects inline (not wrapped as { RawStmt: ... } nodes)
18
+ * Example: { version: 170004, stmts: [{ stmt: {...}, stmt_len: 32 }] }
19
+ *
20
+ * 2. Wrapped ParseResult - When explicitly wrapped as a Node
21
+ * Structure: { ParseResult: { version: number, stmts: RawStmt[] } }
22
+ *
23
+ * 3. Wrapped RawStmt - When explicitly wrapped as a Node
24
+ * Structure: { RawStmt: { stmt: Node, stmt_len?: number } }
25
+ *
26
+ * 4. Array of Nodes - Multiple statements to deparse
27
+ * Can be: Node[] (e.g., SelectStmt, InsertStmt, etc.)
28
+ *
29
+ * 5. Single Node - Individual statement node
30
+ * Example: { SelectStmt: {...} }, { InsertStmt: {...} }, etc.
31
+ *
32
+ * The deparser automatically detects bare ParseResult objects for backward
33
+ * compatibility and wraps them internally for consistent processing.
34
+ */
35
+ export declare class Deparser implements DeparserVisitor {
36
+ private formatter;
37
+ private tree;
38
+ private options;
39
+ constructor(tree: Node | Node[] | t.ParseResult, opts?: DeparserOptions);
40
+ /**
41
+ * Static method to deparse PostgreSQL AST nodes to SQL
42
+ * @param query - Can be:
43
+ * - ParseResult from libpg-query (e.g., { version: 170004, stmts: [...] })
44
+ * - Wrapped ParseResult node (e.g., { ParseResult: {...} })
45
+ * - Wrapped RawStmt node (e.g., { RawStmt: {...} })
46
+ * - Array of Nodes
47
+ * - Single Node (e.g., { SelectStmt: {...} })
48
+ * @param opts - Deparser options for formatting
49
+ * @returns The deparsed SQL string
50
+ */
51
+ static deparse(query: Node | Node[] | t.ParseResult, opts?: DeparserOptions): string;
52
+ deparseQuery(): string;
53
+ /**
54
+ * Get the appropriate function delimiter based on the body content
55
+ * @param body The function body to check
56
+ * @returns The delimiter to use
57
+ */
58
+ private getFunctionDelimiter;
59
+ deparse(node: Node, context?: DeparserContext): string | null;
60
+ visit(node: Node, context?: DeparserContext): string;
61
+ getNodeType(node: Node): string;
62
+ getNodeData(node: Node): any;
63
+ ParseResult(node: t.ParseResult, context: DeparserContext): string;
64
+ RawStmt(node: t.RawStmt, context: DeparserContext): string;
65
+ SelectStmt(node: t.SelectStmt, context: DeparserContext): string;
66
+ A_Expr(node: t.A_Expr, context: DeparserContext): string;
67
+ deparseOperatorName(name: t.Node[]): string;
68
+ private getOperatorPrecedence;
69
+ private needsParentheses;
70
+ private isComplexExpression;
71
+ visitBetweenRange(rexpr: any, context: DeparserContext): string;
72
+ InsertStmt(node: t.InsertStmt, context: DeparserContext): string;
73
+ UpdateStmt(node: t.UpdateStmt, context: DeparserContext): string;
74
+ DeleteStmt(node: t.DeleteStmt, context: DeparserContext): string;
75
+ WithClause(node: t.WithClause, context: DeparserContext): string;
76
+ ResTarget(node: t.ResTarget, context: DeparserContext): string;
77
+ deparseReturningList(list: t.Node[], context: DeparserContext): string;
78
+ BoolExpr(node: t.BoolExpr, context: DeparserContext): string;
79
+ FuncCall(node: t.FuncCall, context: DeparserContext): string;
80
+ FuncExpr(node: t.FuncExpr, context: DeparserContext): string;
81
+ A_Const(node: t.A_Const, context: DeparserContext): string;
82
+ ColumnRef(node: t.ColumnRef, context: DeparserContext): string;
83
+ TypeName(node: t.TypeName, context: DeparserContext): string;
84
+ Alias(node: t.Alias, context: DeparserContext): string;
85
+ RangeVar(node: t.RangeVar, context: DeparserContext): string;
86
+ formatIntervalTypeMods(typmods: t.Node[], context: DeparserContext): string | null;
87
+ formatTypeMods(typmods: t.Node[], context: DeparserContext): string | null;
88
+ formatSingleTypeMod(typemod: number, typeName: string): string | null;
89
+ getPgCatalogTypeName(typeName: string, size: string | null): string;
90
+ A_ArrayExpr(node: t.A_ArrayExpr, context: DeparserContext): string;
91
+ A_Indices(node: t.A_Indices, context: DeparserContext): string;
92
+ A_Indirection(node: t.A_Indirection, context: DeparserContext): string;
93
+ A_Star(node: t.A_Star, context: DeparserContext): string;
94
+ CaseExpr(node: t.CaseExpr, context: DeparserContext): string;
95
+ CoalesceExpr(node: t.CoalesceExpr, context: DeparserContext): string;
96
+ TypeCast(node: t.TypeCast, context: DeparserContext): string;
97
+ CollateClause(node: t.CollateClause, context: DeparserContext): string;
98
+ BooleanTest(node: t.BooleanTest, context: DeparserContext): string;
99
+ NullTest(node: t.NullTest, context: DeparserContext): string;
100
+ private static readonly RESERVED_WORDS;
101
+ private static needsQuotes;
102
+ quoteIfNeeded(value: string): string;
103
+ preserveOperatorDefElemCase(defName: string): string;
104
+ String(node: t.String, context: DeparserContext): string;
105
+ Integer(node: t.Integer, context: DeparserContext): string;
106
+ Float(node: t.Float, context: DeparserContext): string;
107
+ Boolean(node: t.Boolean, context: DeparserContext): string;
108
+ BitString(node: t.BitString, context: DeparserContext): string;
109
+ Null(node: t.Node, context: DeparserContext): string;
110
+ List(node: t.List, context: DeparserContext): string;
111
+ CreateStmt(node: t.CreateStmt, context: DeparserContext): string;
112
+ ColumnDef(node: t.ColumnDef, context: DeparserContext): string;
113
+ Constraint(node: t.Constraint, context: DeparserContext): string;
114
+ SubLink(node: t.SubLink, context: DeparserContext): string;
115
+ CaseWhen(node: t.CaseWhen, context: DeparserContext): string;
116
+ WindowDef(node: t.WindowDef, context: DeparserContext): string;
117
+ formatWindowFrame(node: any): string | null;
118
+ SortBy(node: t.SortBy, context: DeparserContext): string;
119
+ GroupingSet(node: t.GroupingSet, context: DeparserContext): string;
120
+ CommonTableExpr(node: t.CommonTableExpr, context: DeparserContext): string;
121
+ ParamRef(node: t.ParamRef, context: DeparserContext): string;
122
+ LockingClause(node: any, context: DeparserContext): string;
123
+ MinMaxExpr(node: t.MinMaxExpr, context: DeparserContext): string;
124
+ RowExpr(node: t.RowExpr, context: DeparserContext): string;
125
+ OpExpr(node: t.OpExpr, context: DeparserContext): string;
126
+ DistinctExpr(node: t.DistinctExpr, context: DeparserContext): string;
127
+ NullIfExpr(node: t.NullIfExpr, context: DeparserContext): string;
128
+ ScalarArrayOpExpr(node: t.ScalarArrayOpExpr, context: DeparserContext): string;
129
+ Aggref(node: t.Aggref, context: DeparserContext): string;
130
+ WindowFunc(node: t.WindowFunc, context: DeparserContext): string;
131
+ FieldSelect(node: t.FieldSelect, context: DeparserContext): string;
132
+ RelabelType(node: t.RelabelType, context: DeparserContext): string;
133
+ CoerceViaIO(node: t.CoerceViaIO, context: DeparserContext): string;
134
+ ArrayCoerceExpr(node: t.ArrayCoerceExpr, context: DeparserContext): string;
135
+ ConvertRowtypeExpr(node: t.ConvertRowtypeExpr, context: DeparserContext): string;
136
+ NamedArgExpr(node: t.NamedArgExpr, context: DeparserContext): string;
137
+ ViewStmt(node: t.ViewStmt, context: DeparserContext): string;
138
+ IndexStmt(node: t.IndexStmt, context: DeparserContext): string;
139
+ IndexElem(node: t.IndexElem, context: DeparserContext): string;
140
+ PartitionElem(node: t.PartitionElem, context: DeparserContext): string;
141
+ PartitionCmd(node: t.PartitionCmd, context: DeparserContext): string;
142
+ private getAggFunctionName;
143
+ private getWindowFunctionName;
144
+ private getOperatorName;
145
+ JoinExpr(node: t.JoinExpr, context: DeparserContext): string;
146
+ FromExpr(node: t.FromExpr, context: DeparserContext): string;
147
+ TransactionStmt(node: t.TransactionStmt, context: DeparserContext): string;
148
+ VariableSetStmt(node: t.VariableSetStmt, context: DeparserContext): string;
149
+ VariableShowStmt(node: t.VariableShowStmt, context: DeparserContext): string;
150
+ CreateSchemaStmt(node: t.CreateSchemaStmt, context: DeparserContext): string;
151
+ RoleSpec(node: t.RoleSpec, context: DeparserContext): string;
152
+ roletype(node: any, context: DeparserContext): string;
153
+ DropStmt(node: t.DropStmt, context: DeparserContext): string;
154
+ TruncateStmt(node: t.TruncateStmt, context: DeparserContext): string;
155
+ ReturnStmt(node: t.ReturnStmt, context: DeparserContext): string;
156
+ PLAssignStmt(node: t.PLAssignStmt, context: DeparserContext): string;
157
+ CopyStmt(node: t.CopyStmt, context: DeparserContext): string;
158
+ AlterTableStmt(node: t.AlterTableStmt, context: DeparserContext): string;
159
+ AlterTableCmd(node: t.AlterTableCmd, context: DeparserContext): string;
160
+ CreateFunctionStmt(node: t.CreateFunctionStmt, context: DeparserContext): string;
161
+ FunctionParameter(node: t.FunctionParameter, context: DeparserContext): string;
162
+ CreateEnumStmt(node: t.CreateEnumStmt, context: DeparserContext): string;
163
+ CreateDomainStmt(node: t.CreateDomainStmt, context: DeparserContext): string;
164
+ CreateRoleStmt(node: t.CreateRoleStmt, context: DeparserContext): string;
165
+ DefElem(node: t.DefElem, context: DeparserContext): string;
166
+ CreateTableSpaceStmt(node: t.CreateTableSpaceStmt, context: DeparserContext): string;
167
+ DropTableSpaceStmt(node: t.DropTableSpaceStmt, context: DeparserContext): string;
168
+ AlterTableSpaceOptionsStmt(node: t.AlterTableSpaceOptionsStmt, context: DeparserContext): string;
169
+ CreateExtensionStmt(node: t.CreateExtensionStmt, context: DeparserContext): string;
170
+ AlterExtensionStmt(node: t.AlterExtensionStmt, context: DeparserContext): string;
171
+ CreateFdwStmt(node: t.CreateFdwStmt, context: DeparserContext): string;
172
+ SetOperationStmt(node: t.SetOperationStmt, context: DeparserContext): string;
173
+ ReplicaIdentityStmt(node: t.ReplicaIdentityStmt, context: DeparserContext): string;
174
+ AlterCollationStmt(node: t.AlterCollationStmt, context: DeparserContext): string;
175
+ AlterDomainStmt(node: t.AlterDomainStmt, context: DeparserContext): string;
176
+ PrepareStmt(node: t.PrepareStmt, context: DeparserContext): string;
177
+ ExecuteStmt(node: t.ExecuteStmt, context: DeparserContext): string;
178
+ DeallocateStmt(node: t.DeallocateStmt, context: DeparserContext): string;
179
+ NotifyStmt(node: t.NotifyStmt, context: DeparserContext): string;
180
+ ListenStmt(node: t.ListenStmt, context: DeparserContext): string;
181
+ UnlistenStmt(node: t.UnlistenStmt, context: DeparserContext): string;
182
+ CheckPointStmt(node: t.CheckPointStmt, context: DeparserContext): string;
183
+ LoadStmt(node: t.LoadStmt, context: DeparserContext): string;
184
+ DiscardStmt(node: t.DiscardStmt, context: DeparserContext): string;
185
+ CommentStmt(node: t.CommentStmt, context: DeparserContext): string;
186
+ LockStmt(node: t.LockStmt, context: DeparserContext): string;
187
+ CreatePolicyStmt(node: t.CreatePolicyStmt, context: DeparserContext): string;
188
+ AlterPolicyStmt(node: t.AlterPolicyStmt, context: DeparserContext): string;
189
+ CreateUserMappingStmt(node: t.CreateUserMappingStmt, context: DeparserContext): string;
190
+ CreateStatsStmt(node: t.CreateStatsStmt, context: DeparserContext): string;
191
+ StatsElem(node: t.StatsElem, context: DeparserContext): string;
192
+ CreatePublicationStmt(node: t.CreatePublicationStmt, context: DeparserContext): string;
193
+ CreateSubscriptionStmt(node: t.CreateSubscriptionStmt, context: DeparserContext): string;
194
+ AlterPublicationStmt(node: t.AlterPublicationStmt, context: DeparserContext): string;
195
+ AlterSubscriptionStmt(node: t.AlterSubscriptionStmt, context: DeparserContext): string;
196
+ DropSubscriptionStmt(node: t.DropSubscriptionStmt, context: DeparserContext): string;
197
+ DoStmt(node: t.DoStmt, context: DeparserContext): string;
198
+ private generateUniqueDollarTag;
199
+ InlineCodeBlock(node: t.InlineCodeBlock, context: DeparserContext): string;
200
+ CallContext(node: t.CallContext, context: DeparserContext): string;
201
+ ConstraintsSetStmt(node: t.ConstraintsSetStmt, context: DeparserContext): string;
202
+ AlterSystemStmt(node: t.AlterSystemStmt, context: DeparserContext): string;
203
+ VacuumRelation(node: t.VacuumRelation, context: DeparserContext): string;
204
+ DropOwnedStmt(node: t.DropOwnedStmt, context: DeparserContext): string;
205
+ ReassignOwnedStmt(node: t.ReassignOwnedStmt, context: DeparserContext): string;
206
+ AlterTSDictionaryStmt(node: t.AlterTSDictionaryStmt, context: DeparserContext): string;
207
+ AlterTSConfigurationStmt(node: t.AlterTSConfigurationStmt, context: DeparserContext): string;
208
+ ClosePortalStmt(node: t.ClosePortalStmt, context: DeparserContext): string;
209
+ FetchStmt(node: t.FetchStmt, context: DeparserContext): string;
210
+ AlterStatsStmt(node: t.AlterStatsStmt, context: DeparserContext): string;
211
+ ObjectWithArgs(node: t.ObjectWithArgs, context: DeparserContext): string;
212
+ AlterOperatorStmt(node: t.AlterOperatorStmt, context: DeparserContext): string;
213
+ AlterFdwStmt(node: t.AlterFdwStmt, context: DeparserContext): string;
214
+ CreateForeignServerStmt(node: t.CreateForeignServerStmt, context: DeparserContext): string;
215
+ AlterForeignServerStmt(node: t.AlterForeignServerStmt, context: DeparserContext): string;
216
+ AlterUserMappingStmt(node: t.AlterUserMappingStmt, context: DeparserContext): string;
217
+ DropUserMappingStmt(node: t.DropUserMappingStmt, context: DeparserContext): string;
218
+ ImportForeignSchemaStmt(node: t.ImportForeignSchemaStmt, context: DeparserContext): string;
219
+ ClusterStmt(node: t.ClusterStmt, context: DeparserContext): string;
220
+ VacuumStmt(node: t.VacuumStmt, context: DeparserContext): string;
221
+ ExplainStmt(node: t.ExplainStmt, context: DeparserContext): string;
222
+ ReindexStmt(node: t.ReindexStmt, context: DeparserContext): string;
223
+ CallStmt(node: t.CallStmt, context: DeparserContext): string;
224
+ CreatedbStmt(node: t.CreatedbStmt, context: DeparserContext): string;
225
+ DropdbStmt(node: t.DropdbStmt, context: DeparserContext): string;
226
+ RenameStmt(node: t.RenameStmt, context: DeparserContext): string;
227
+ AlterOwnerStmt(node: t.AlterOwnerStmt, context: DeparserContext): string;
228
+ GrantStmt(node: t.GrantStmt, context: DeparserContext): string;
229
+ GrantRoleStmt(node: t.GrantRoleStmt, context: DeparserContext): string;
230
+ SecLabelStmt(node: t.SecLabelStmt, context: DeparserContext): string;
231
+ AlterDefaultPrivilegesStmt(node: t.AlterDefaultPrivilegesStmt, context: DeparserContext): string;
232
+ CreateConversionStmt(node: t.CreateConversionStmt, context: DeparserContext): string;
233
+ CreateCastStmt(node: t.CreateCastStmt, context: DeparserContext): string;
234
+ CreatePLangStmt(node: t.CreatePLangStmt, context: DeparserContext): string;
235
+ CreateTransformStmt(node: t.CreateTransformStmt, context: DeparserContext): string;
236
+ CreateTrigStmt(node: t.CreateTrigStmt, context: DeparserContext): string;
237
+ TriggerTransition(node: t.TriggerTransition, context: DeparserContext): string;
238
+ CreateEventTrigStmt(node: t.CreateEventTrigStmt, context: DeparserContext): string;
239
+ AlterEventTrigStmt(node: t.AlterEventTrigStmt, context: DeparserContext): string;
240
+ CreateOpClassStmt(node: t.CreateOpClassStmt, context: DeparserContext): string;
241
+ CreateOpFamilyStmt(node: t.CreateOpFamilyStmt, context: DeparserContext): string;
242
+ AlterOpFamilyStmt(node: t.AlterOpFamilyStmt, context: DeparserContext): string;
243
+ MergeStmt(node: t.MergeStmt, context: DeparserContext): string;
244
+ AlterTableMoveAllStmt(node: t.AlterTableMoveAllStmt, context: DeparserContext): string;
245
+ CreateSeqStmt(node: t.CreateSeqStmt, context: DeparserContext): string;
246
+ AlterSeqStmt(node: t.AlterSeqStmt, context: DeparserContext): string;
247
+ CompositeTypeStmt(node: t.CompositeTypeStmt, context: DeparserContext): string;
248
+ CreateRangeStmt(node: t.CreateRangeStmt, context: DeparserContext): string;
249
+ AlterEnumStmt(node: t.AlterEnumStmt, context: DeparserContext): string;
250
+ AlterTypeStmt(node: t.AlterTypeStmt, context: DeparserContext): string;
251
+ AlterRoleStmt(node: t.AlterRoleStmt, context: DeparserContext): string;
252
+ DropRoleStmt(node: t.DropRoleStmt, context: DeparserContext): string;
253
+ targetList(node: any, context: DeparserContext): string;
254
+ CreateAggregateStmt(node: t.DefineStmt, context: DeparserContext): string;
255
+ CreateTableAsStmt(node: t.CreateTableAsStmt, context: DeparserContext): string;
256
+ RefreshMatViewStmt(node: t.RefreshMatViewStmt, context: DeparserContext): string;
257
+ AccessPriv(node: t.AccessPriv, context: DeparserContext): string;
258
+ aliasname(node: any, context: DeparserContext): string;
259
+ DefineStmt(node: t.DefineStmt, context: DeparserContext): string;
260
+ AlterDatabaseStmt(node: t.AlterDatabaseStmt, context: DeparserContext): string;
261
+ AlterDatabaseRefreshCollStmt(node: t.AlterDatabaseRefreshCollStmt, context: DeparserContext): string;
262
+ AlterDatabaseSetStmt(node: t.AlterDatabaseSetStmt, context: DeparserContext): string;
263
+ DeclareCursorStmt(node: t.DeclareCursorStmt, context: DeparserContext): string;
264
+ PublicationObjSpec(node: t.PublicationObjSpec, context: DeparserContext): string;
265
+ PublicationTable(node: t.PublicationTable, context: DeparserContext): string;
266
+ CreateAmStmt(node: t.CreateAmStmt, context: DeparserContext): string;
267
+ IntoClause(node: t.IntoClause, context: DeparserContext): string;
268
+ OnConflictExpr(node: t.OnConflictExpr, context: DeparserContext): string;
269
+ ScanToken(node: t.ScanToken, context: DeparserContext): string;
270
+ CreateOpClassItem(node: t.CreateOpClassItem, context: DeparserContext): string;
271
+ Var(node: t.Var, context: DeparserContext): string;
272
+ TableFunc(node: t.TableFunc, context: DeparserContext): string;
273
+ RangeTableFunc(node: t.RangeTableFunc, context: DeparserContext): string;
274
+ RangeTableFuncCol(node: t.RangeTableFuncCol, context: DeparserContext): string;
275
+ JsonArrayQueryConstructor(node: t.JsonArrayQueryConstructor, context: DeparserContext): string;
276
+ RangeFunction(node: t.RangeFunction, context: DeparserContext): string;
277
+ XmlExpr(node: t.XmlExpr, context: DeparserContext): string;
278
+ schemaname(node: any, context: DeparserContext): string;
279
+ RangeTableSample(node: t.RangeTableSample, context: DeparserContext): string;
280
+ XmlSerialize(node: t.XmlSerialize, context: DeparserContext): string;
281
+ ctes(node: any, context: DeparserContext): string;
282
+ RuleStmt(node: t.RuleStmt, context: DeparserContext): string;
283
+ RangeSubselect(node: t.RangeSubselect, context: DeparserContext): string;
284
+ relname(node: any, context: DeparserContext): string;
285
+ rel(node: any, context: DeparserContext): string;
286
+ objname(node: any, context: DeparserContext): string;
287
+ SQLValueFunction(node: t.SQLValueFunction, context: DeparserContext): string;
288
+ GroupingFunc(node: t.GroupingFunc, context: DeparserContext): string;
289
+ MultiAssignRef(node: t.MultiAssignRef, context: DeparserContext): string;
290
+ SetToDefault(node: t.SetToDefault, context: DeparserContext): string;
291
+ CurrentOfExpr(node: t.CurrentOfExpr, context: DeparserContext): string;
292
+ TableLikeClause(node: t.TableLikeClause, context: DeparserContext): string;
293
+ AlterFunctionStmt(node: t.AlterFunctionStmt, context: DeparserContext): string;
294
+ AlterObjectSchemaStmt(node: t.AlterObjectSchemaStmt, context: DeparserContext): string;
295
+ AlterRoleSetStmt(node: t.AlterRoleSetStmt, context: DeparserContext): string;
296
+ CreateForeignTableStmt(node: t.CreateForeignTableStmt, context: DeparserContext): string;
297
+ }