pgsql-deparser 13.15.0 → 14.0.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.
- package/README.md +88 -45
- package/dist/README.md +160 -0
- package/dist/deparser/deparser.d.ts +301 -0
- package/dist/deparser/deparser.js +10005 -0
- package/dist/deparser/index.d.ts +9 -0
- package/dist/deparser/index.js +17 -0
- package/dist/deparser/utils/list-utils.d.ts +8 -0
- package/dist/deparser/utils/list-utils.js +30 -0
- package/dist/deparser/utils/quote-utils.d.ts +24 -0
- package/dist/deparser/utils/quote-utils.js +89 -0
- package/dist/deparser/utils/sql-formatter.d.ts +16 -0
- package/dist/deparser/utils/sql-formatter.js +40 -0
- package/dist/deparser/visitors/base.d.ts +21 -0
- package/dist/deparser/visitors/base.js +34 -0
- package/dist/esm/deparser/deparser.js +10001 -0
- package/dist/esm/deparser/index.js +13 -0
- package/dist/esm/deparser/utils/list-utils.js +26 -0
- package/dist/esm/deparser/utils/quote-utils.js +85 -0
- package/dist/esm/deparser/utils/sql-formatter.js +36 -0
- package/dist/esm/deparser/visitors/base.js +30 -0
- package/dist/esm/index.js +15 -0
- package/dist/esm/v14-to-v15.js +1220 -0
- package/dist/esm/v14-to-v17-direct.js +67 -0
- package/dist/esm/v15-to-v16.js +2881 -0
- package/dist/esm/v16-to-v17.js +1488 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +19 -0
- package/dist/package.json +42 -0
- package/dist/v14-to-v15.d.ts +616 -0
- package/dist/v14-to-v15.js +1224 -0
- package/dist/v14-to-v17-direct.d.ts +23 -0
- package/dist/v14-to-v17-direct.js +71 -0
- package/dist/v15-to-v16.d.ts +627 -0
- package/dist/v15-to-v16.js +2885 -0
- package/dist/v16-to-v17.d.ts +638 -0
- package/dist/v16-to-v17.js +1492 -0
- package/package.json +26 -73
- package/src/deparser/deparser.ts +10026 -0
- package/src/deparser/index.ts +14 -0
- package/src/deparser/utils/list-utils.ts +27 -0
- package/src/deparser/utils/quote-utils.ts +86 -0
- package/src/deparser/utils/sql-formatter.ts +37 -0
- package/src/deparser/visitors/base.ts +40 -0
- package/src/index.ts +27 -3
- package/src/v14-to-v15.ts +1621 -0
- package/src/v14-to-v17-direct.ts +68 -0
- package/src/v15-to-v16.ts +3290 -0
- package/src/v16-to-v17.ts +1897 -0
- package/tsconfig.esm.json +8 -0
- package/tsconfig.json +26 -0
- package/main/deparser.js +0 -3481
- package/main/index.js +0 -10
- package/main/utils/index.js +0 -97
- package/module/deparser.js +0 -3478
- package/module/index.js +0 -3
- package/module/utils/index.js +0 -90
- package/src/deparser.ts +0 -4220
- package/src/utils/index.ts +0 -92
- package/types/deparser.d.ts +0 -119
- package/types/index.d.ts +0 -3
- package/types/utils/index.d.ts +0 -4
- /package/{LICENSE → dist/LICENSE} +0 -0
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
|
|
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.
|
|
18
18
|
|
|
19
19
|
## Installation
|
|
20
20
|
|
|
@@ -22,11 +22,12 @@
|
|
|
22
22
|
npm install pgsql-deparser
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
##
|
|
25
|
+
## Features
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
- **
|
|
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
|
|
30
31
|
|
|
31
32
|
## Deparser Example
|
|
32
33
|
|
|
@@ -35,20 +36,21 @@ The `pgsql-deparser` module serializes ASTs to SQL in pure TypeScript, avoiding
|
|
|
35
36
|
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`:
|
|
36
37
|
|
|
37
38
|
```ts
|
|
38
|
-
import
|
|
39
|
-
import {
|
|
39
|
+
import * as t from '@pgsql/utils';
|
|
40
|
+
import { RangeVar, SelectStmt } from '@pgsql/types';
|
|
41
|
+
import { deparseSync as deparse } from 'pgsql-deparser';
|
|
40
42
|
|
|
41
43
|
// This could have been obtained from any JSON or AST, not necessarily @pgsql/utils
|
|
42
|
-
const stmt: SelectStmt =
|
|
44
|
+
const stmt: { SelectStmt: SelectStmt } = t.nodes.selectStmt({
|
|
43
45
|
targetList: [
|
|
44
|
-
|
|
45
|
-
val:
|
|
46
|
-
fields: [
|
|
46
|
+
t.nodes.resTarget({
|
|
47
|
+
val: t.nodes.columnRef({
|
|
48
|
+
fields: [t.nodes.aStar()]
|
|
47
49
|
})
|
|
48
50
|
})
|
|
49
51
|
],
|
|
50
52
|
fromClause: [
|
|
51
|
-
|
|
53
|
+
t.nodes.rangeVar({
|
|
52
54
|
relname: 'some_table',
|
|
53
55
|
inh: true,
|
|
54
56
|
relpersistence: 'p'
|
|
@@ -58,60 +60,101 @@ const stmt: SelectStmt = ast.selectStmt({
|
|
|
58
60
|
op: 'SETOP_NONE'
|
|
59
61
|
});
|
|
60
62
|
|
|
61
|
-
// Modify the AST if needed
|
|
62
|
-
stmt.SelectStmt.fromClause[0].RangeVar.relname = 'another_table';
|
|
63
|
+
// Modify the AST if needed
|
|
64
|
+
(stmt.SelectStmt.fromClause[0] as {RangeVar: RangeVar}).RangeVar.relname = 'another_table';
|
|
63
65
|
|
|
64
66
|
// Deparse the modified AST back to a SQL string
|
|
65
|
-
console.log(deparse(
|
|
67
|
+
console.log(deparse(stmt));
|
|
66
68
|
|
|
67
69
|
// Output: SELECT * FROM another_table
|
|
68
70
|
```
|
|
69
71
|
|
|
70
|
-
|
|
72
|
+
### Latest Version (PostgreSQL 17)
|
|
71
73
|
|
|
72
|
-
|
|
74
|
+
```sh
|
|
75
|
+
npm install pgsql-deparser
|
|
76
|
+
```
|
|
73
77
|
|
|
74
|
-
|
|
78
|
+
### Version-Specific Packages (PostgreSQL 13-16)
|
|
75
79
|
|
|
76
|
-
|
|
80
|
+
While we highly recommend using PG17, for PostgreSQL versions 13-16, use the version-specific packages:
|
|
77
81
|
|
|
78
|
-
|
|
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
|
+
```
|
|
79
88
|
|
|
80
|
-
|
|
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)) |
|
|
89
|
+
## Options
|
|
86
90
|
|
|
91
|
+
The deparser accepts optional configuration for formatting and output control:
|
|
87
92
|
|
|
88
|
-
|
|
93
|
+
```ts
|
|
94
|
+
import { deparseSync as deparse } from 'pgsql-deparser';
|
|
89
95
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
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.
|
|
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
|
+
};
|
|
98
102
|
|
|
99
|
-
|
|
103
|
+
const sql = deparse(ast, options);
|
|
104
|
+
```
|
|
100
105
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
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 |
|
|
112
|
+
|
|
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
|
+
```
|
|
128
|
+
|
|
129
|
+
For complete documentation and advanced options, see [DEPARSER_USAGE.md](../../DEPARSER_USAGE.md).
|
|
130
|
+
|
|
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.
|
|
104
134
|
|
|
105
135
|
## Credits
|
|
106
136
|
|
|
107
|
-
|
|
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
|
|
108
144
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
* [
|
|
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.
|
|
112
155
|
|
|
113
156
|
## Disclaimer
|
|
114
157
|
|
|
115
|
-
AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED
|
|
158
|
+
AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED "AS IS", AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.
|
|
116
159
|
|
|
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.
|
|
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.
|
package/dist/README.md
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# pgsql-deparser
|
|
2
|
+
|
|
3
|
+
<p align="center" width="100%">
|
|
4
|
+
<img height="120" src="https://github.com/launchql/pgsql-parser/assets/545047/6440fa7d-918b-4a3b-8d1b-755d85de8bea" />
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center" width="100%">
|
|
8
|
+
<a href="https://github.com/launchql/pgsql-parser/actions/workflows/run-tests.yaml">
|
|
9
|
+
<img height="20" src="https://github.com/launchql/pgsql-parser/actions/workflows/run-tests.yaml/badge.svg" />
|
|
10
|
+
</a>
|
|
11
|
+
<a href="https://www.npmjs.com/package/pgsql-deparser"><img height="20" src="https://img.shields.io/npm/dt/pgsql-deparser"></a>
|
|
12
|
+
<a href="https://www.npmjs.com/package/pgsql-deparser"><img height="20" src="https://img.shields.io/npm/dw/pgsql-deparser"/></a>
|
|
13
|
+
<a href="https://github.com/launchql/pgsql-parser/blob/main/LICENSE-MIT"><img height="20" src="https://img.shields.io/badge/license-MIT-blue.svg"/></a>
|
|
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
|
+
</p>
|
|
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.
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
npm install pgsql-deparser
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Features
|
|
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
|
|
31
|
+
|
|
32
|
+
## Deparser Example
|
|
33
|
+
|
|
34
|
+
The `pgsql-deparser` module serializes ASTs to SQL in pure TypeScript, avoiding the full parser's native dependencies. It's useful when only SQL string conversion from ASTs is needed, and is written in pure TypeScript for easy cross-environment deployment.
|
|
35
|
+
|
|
36
|
+
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
|
+
|
|
38
|
+
```ts
|
|
39
|
+
import * as t from '@pgsql/utils';
|
|
40
|
+
import { RangeVar, SelectStmt } from '@pgsql/types';
|
|
41
|
+
import { deparseSync as deparse } from 'pgsql-deparser';
|
|
42
|
+
|
|
43
|
+
// This could have been obtained from any JSON or AST, not necessarily @pgsql/utils
|
|
44
|
+
const stmt: { SelectStmt: SelectStmt } = t.nodes.selectStmt({
|
|
45
|
+
targetList: [
|
|
46
|
+
t.nodes.resTarget({
|
|
47
|
+
val: t.nodes.columnRef({
|
|
48
|
+
fields: [t.nodes.aStar()]
|
|
49
|
+
})
|
|
50
|
+
})
|
|
51
|
+
],
|
|
52
|
+
fromClause: [
|
|
53
|
+
t.nodes.rangeVar({
|
|
54
|
+
relname: 'some_table',
|
|
55
|
+
inh: true,
|
|
56
|
+
relpersistence: 'p'
|
|
57
|
+
})
|
|
58
|
+
],
|
|
59
|
+
limitOption: 'LIMIT_OPTION_DEFAULT',
|
|
60
|
+
op: 'SETOP_NONE'
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
// Modify the AST if needed
|
|
64
|
+
(stmt.SelectStmt.fromClause[0] as {RangeVar: RangeVar}).RangeVar.relname = 'another_table';
|
|
65
|
+
|
|
66
|
+
// Deparse the modified AST back to a SQL string
|
|
67
|
+
console.log(deparse(stmt));
|
|
68
|
+
|
|
69
|
+
// Output: SELECT * FROM another_table
|
|
70
|
+
```
|
|
71
|
+
|
|
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:
|
|
81
|
+
|
|
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
|
+
```
|
|
88
|
+
|
|
89
|
+
## Options
|
|
90
|
+
|
|
91
|
+
The deparser accepts optional configuration for formatting and output control:
|
|
92
|
+
|
|
93
|
+
```ts
|
|
94
|
+
import { deparseSync as deparse } from 'pgsql-deparser';
|
|
95
|
+
|
|
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
|
+
};
|
|
102
|
+
|
|
103
|
+
const sql = deparse(ast, options);
|
|
104
|
+
```
|
|
105
|
+
|
|
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 |
|
|
112
|
+
|
|
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
|
+
```
|
|
128
|
+
|
|
129
|
+
For complete documentation and advanced options, see [DEPARSER_USAGE.md](../../DEPARSER_USAGE.md).
|
|
130
|
+
|
|
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.
|
|
134
|
+
|
|
135
|
+
## Credits
|
|
136
|
+
|
|
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
|
|
144
|
+
|
|
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.
|
|
155
|
+
|
|
156
|
+
## Disclaimer
|
|
157
|
+
|
|
158
|
+
AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED "AS IS", AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.
|
|
159
|
+
|
|
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.
|