pgsql-deparser 18.3.3 → 18.3.7

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/deparser.js CHANGED
@@ -2870,6 +2870,15 @@ class Deparser {
2870
2870
  deleteClause += 'SET DEFAULT';
2871
2871
  break;
2872
2872
  }
2873
+ if ((node.fk_del_action === 'n' || node.fk_del_action === 'd') && node.fk_del_set_cols && node.fk_del_set_cols.length > 0) {
2874
+ const setColumns = list_utils_1.ListUtils.unwrapList(node.fk_del_set_cols)
2875
+ .map(column => {
2876
+ const stringNode = column.String;
2877
+ return quotes_1.QuoteUtils.quoteIdentifier(stringNode.sval || stringNode.str || '');
2878
+ })
2879
+ .join(', ');
2880
+ deleteClause += ` (${setColumns})`;
2881
+ }
2873
2882
  if (context.isPretty()) {
2874
2883
  output.push('\n' + context.indent(deleteClause));
2875
2884
  }
@@ -3630,12 +3639,12 @@ class Deparser {
3630
3639
  }
3631
3640
  PartitionCmd(node, context) {
3632
3641
  const output = [];
3642
+ if (node.name) {
3643
+ output.push(this.RangeVar(node.name, context));
3644
+ }
3633
3645
  if (node.concurrent) {
3634
3646
  output.push('CONCURRENTLY');
3635
3647
  }
3636
- if (node.name) {
3637
- output.push(this.visit(node.name, context));
3638
- }
3639
3648
  if (node.bound) {
3640
3649
  if (node.bound.strategy === 'l' && node.bound.listdatums) {
3641
3650
  output.push('FOR VALUES IN');
@@ -3660,9 +3669,9 @@ class Deparser {
3660
3669
  output.push(`(${upperValues})`);
3661
3670
  }
3662
3671
  }
3663
- else if (node.bound.strategy === 'h' && node.bound.modulus !== undefined && node.bound.remainder !== undefined) {
3672
+ else if (node.bound.strategy === 'h' && node.bound.modulus !== undefined) {
3664
3673
  output.push('FOR VALUES WITH');
3665
- output.push(`(modulus ${node.bound.modulus}, remainder ${node.bound.remainder})`);
3674
+ output.push(`(MODULUS ${node.bound.modulus}, REMAINDER ${node.bound.remainder ?? 0})`);
3666
3675
  }
3667
3676
  else if (node.bound.is_default) {
3668
3677
  output.push('DEFAULT');
package/esm/deparser.js CHANGED
@@ -2867,6 +2867,15 @@ export class Deparser {
2867
2867
  deleteClause += 'SET DEFAULT';
2868
2868
  break;
2869
2869
  }
2870
+ if ((node.fk_del_action === 'n' || node.fk_del_action === 'd') && node.fk_del_set_cols && node.fk_del_set_cols.length > 0) {
2871
+ const setColumns = ListUtils.unwrapList(node.fk_del_set_cols)
2872
+ .map(column => {
2873
+ const stringNode = column.String;
2874
+ return QuoteUtils.quoteIdentifier(stringNode.sval || stringNode.str || '');
2875
+ })
2876
+ .join(', ');
2877
+ deleteClause += ` (${setColumns})`;
2878
+ }
2870
2879
  if (context.isPretty()) {
2871
2880
  output.push('\n' + context.indent(deleteClause));
2872
2881
  }
@@ -3627,12 +3636,12 @@ export class Deparser {
3627
3636
  }
3628
3637
  PartitionCmd(node, context) {
3629
3638
  const output = [];
3639
+ if (node.name) {
3640
+ output.push(this.RangeVar(node.name, context));
3641
+ }
3630
3642
  if (node.concurrent) {
3631
3643
  output.push('CONCURRENTLY');
3632
3644
  }
3633
- if (node.name) {
3634
- output.push(this.visit(node.name, context));
3635
- }
3636
3645
  if (node.bound) {
3637
3646
  if (node.bound.strategy === 'l' && node.bound.listdatums) {
3638
3647
  output.push('FOR VALUES IN');
@@ -3657,9 +3666,9 @@ export class Deparser {
3657
3666
  output.push(`(${upperValues})`);
3658
3667
  }
3659
3668
  }
3660
- else if (node.bound.strategy === 'h' && node.bound.modulus !== undefined && node.bound.remainder !== undefined) {
3669
+ else if (node.bound.strategy === 'h' && node.bound.modulus !== undefined) {
3661
3670
  output.push('FOR VALUES WITH');
3662
- output.push(`(modulus ${node.bound.modulus}, remainder ${node.bound.remainder})`);
3671
+ output.push(`(MODULUS ${node.bound.modulus}, REMAINDER ${node.bound.remainder ?? 0})`);
3663
3672
  }
3664
3673
  else if (node.bound.is_default) {
3665
3674
  output.push('DEFAULT');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pgsql-deparser",
3
- "version": "18.3.3",
3
+ "version": "18.3.7",
4
4
  "author": "Constructive <developers@constructive.io>",
5
5
  "description": "PostgreSQL AST Deparser",
6
6
  "main": "index.js",
@@ -53,12 +53,12 @@
53
53
  "database"
54
54
  ],
55
55
  "devDependencies": {
56
- "libpg-query": "18.1.4",
56
+ "libpg-query": "18.1.5",
57
57
  "makage": "^0.5.1"
58
58
  },
59
59
  "dependencies": {
60
- "@pgsql/quotes": "18.2.1",
60
+ "@pgsql/quotes": "18.2.4",
61
61
  "@pgsql/types": "^18.0.0"
62
62
  },
63
- "gitHead": "b6105874628cc7b8517c1ebbd99e9ad6fe786976"
63
+ "gitHead": "d8a34a60dacf1b7d5ba6e7443e2438ff049b6a56"
64
64
  }