pgsql-deparser 13.2.0 → 13.3.2

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/CHANGELOG.md CHANGED
@@ -3,6 +3,30 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [13.3.2](https://github.com/pyramation/pgsql-parser/compare/pgsql-deparser@13.3.1...pgsql-deparser@13.3.2) (2022-04-19)
7
+
8
+ **Note:** Version bump only for package pgsql-deparser
9
+
10
+
11
+
12
+
13
+
14
+ ## [13.3.1](https://github.com/pyramation/pgsql-parser/compare/pgsql-deparser@13.3.0...pgsql-deparser@13.3.1) (2022-04-13)
15
+
16
+ **Note:** Version bump only for package pgsql-deparser
17
+
18
+
19
+
20
+
21
+
22
+ # [13.3.0](https://github.com/pyramation/pgsql-parser/compare/pgsql-deparser@13.2.0...pgsql-deparser@13.3.0) (2022-03-18)
23
+
24
+ **Note:** Version bump only for package pgsql-deparser
25
+
26
+
27
+
28
+
29
+
6
30
  # [13.2.0](https://github.com/pyramation/pgsql-parser/compare/pgsql-deparser@13.1.13...pgsql-deparser@13.2.0) (2022-02-24)
7
31
 
8
32
  **Note:** Version bump only for package pgsql-deparser
package/main/deparser.js CHANGED
@@ -2561,7 +2561,9 @@ var Deparser = /*#__PURE__*/function () {
2561
2561
  value: function ViewStmt(node) {
2562
2562
  var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2563
2563
  var output = [];
2564
- output.push('CREATE VIEW');
2564
+ output.push('CREATE');
2565
+ if (node.replace) output.push('OR REPLACE');
2566
+ output.push('VIEW');
2565
2567
  output.push(this.RangeVar(node.view, context));
2566
2568
  output.push('AS');
2567
2569
  output.push(this.deparse(node.query, context));
@@ -3888,6 +3890,23 @@ var Deparser = /*#__PURE__*/function () {
3888
3890
  return output.join(' ');
3889
3891
  }
3890
3892
  }, {
3893
+ key: 'CopyStmt',
3894
+ value: function CopyStmt(node) {
3895
+ var _node$options;
3896
+
3897
+ var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
3898
+ var output = ['COPY'];
3899
+ output.push('(' + this.deparse(node.query, context) + ')');
3900
+ output.push('TO');
3901
+ output.push("'".concat(node.filename, "'"));
3902
+
3903
+ if (((_node$options = node.options) === null || _node$options === void 0 ? void 0 : _node$options.length) > 0 && node.options[0].DefElem.defname === 'format') {
3904
+ output.push("(FORMAT '".concat(this.deparse(node.options[0].DefElem.arg), "')"));
3905
+ }
3906
+
3907
+ return output.join(' ');
3908
+ }
3909
+ }, {
3891
3910
  key: "deparseFrameOptions",
3892
3911
  value: function deparseFrameOptions(options, refName, startOffset, endOffset) {
3893
3912
  // https://github.com/pganalyze/libpg_query/blob/442b1748d06364ecd3779bc558899176c02efaf0/src/postgres/include/nodes/parsenodes.h#L505-L522
@@ -2331,7 +2331,9 @@ export default class Deparser {
2331
2331
 
2332
2332
  ['ViewStmt'](node, context = {}) {
2333
2333
  const output = [];
2334
- output.push('CREATE VIEW');
2334
+ output.push('CREATE');
2335
+ if (node.replace) output.push('OR REPLACE');
2336
+ output.push('VIEW');
2335
2337
  output.push(this.RangeVar(node.view, context));
2336
2338
  output.push('AS');
2337
2339
  output.push(this.deparse(node.query, context));
@@ -3567,6 +3569,19 @@ export default class Deparser {
3567
3569
  return output.join(' ');
3568
3570
  }
3569
3571
 
3572
+ ['CopyStmt'](node, context = {}) {
3573
+ const output = ['COPY'];
3574
+ output.push('(' + this.deparse(node.query, context) + ')');
3575
+ output.push('TO');
3576
+ output.push(`'${node.filename}'`);
3577
+
3578
+ if (node.options?.length > 0 && node.options[0].DefElem.defname === 'format') {
3579
+ output.push(`(FORMAT '${this.deparse(node.options[0].DefElem.arg)}')`);
3580
+ }
3581
+
3582
+ return output.join(' ');
3583
+ }
3584
+
3570
3585
  deparseFrameOptions(options, refName, startOffset, endOffset) {
3571
3586
  // https://github.com/pganalyze/libpg_query/blob/442b1748d06364ecd3779bc558899176c02efaf0/src/postgres/include/nodes/parsenodes.h#L505-L522
3572
3587
  const FRAMEOPTION_NONDEFAULT = 0x00001;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pgsql-deparser",
3
- "version": "13.2.0",
3
+ "version": "13.3.2",
4
4
  "description": "PostgreSQL AST Deparser",
5
5
  "author": "Dan Lynch <pyramation@gmail.com>",
6
6
  "homepage": "https://github.com/pyramation/pgsql-parser",
@@ -65,7 +65,7 @@
65
65
  "eslint-plugin-prettier": "^3.1.2",
66
66
  "glob": "7.1.6",
67
67
  "jest": "^25.1.0",
68
- "pgsql-parser": "^13.2.0",
68
+ "pgsql-parser": "^13.3.2",
69
69
  "prettier": "^2.1.2",
70
70
  "regenerator-runtime": "^0.13.2"
71
71
  },
@@ -75,5 +75,5 @@
75
75
  "lodash": "^4.17.20",
76
76
  "pgsql-enums": "^13.1.2"
77
77
  },
78
- "gitHead": "3d85fd5881d55708803d852524bc17f3a5170ae5"
78
+ "gitHead": "e5b21f3c4f969dc1426498100cabe1608165ed78"
79
79
  }