pgsql-deparser 18.4.0 → 18.4.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/deparser.js CHANGED
@@ -4363,7 +4363,7 @@ class Deparser {
4363
4363
  if (objList && objList.List && objList.List.items) {
4364
4364
  const items = objList.List.items.map((item) => {
4365
4365
  if (item.String && item.String.sval) {
4366
- return item.String.sval;
4366
+ return quotes_1.QuoteUtils.quoteIdentifier(item.String.sval);
4367
4367
  }
4368
4368
  return this.visit(item, context);
4369
4369
  });
@@ -6660,7 +6660,13 @@ class Deparser {
6660
6660
  }
6661
6661
  else if (node.objtype === 'OBJECT_POLICY') {
6662
6662
  // Handle POLICY syntax: COMMENT ON POLICY policy_name ON table_name IS 'comment'
6663
- if (objectParts.length === 2) {
6663
+ if (objectParts.length === 3) {
6664
+ const [schema, table, policy] = objectParts;
6665
+ output.push(policy);
6666
+ output.push('ON');
6667
+ output.push(`${schema}.${table}`);
6668
+ }
6669
+ else if (objectParts.length === 2) {
6664
6670
  const [table, policy] = objectParts;
6665
6671
  output.push(policy);
6666
6672
  output.push('ON');
package/esm/deparser.js CHANGED
@@ -4360,7 +4360,7 @@ export class Deparser {
4360
4360
  if (objList && objList.List && objList.List.items) {
4361
4361
  const items = objList.List.items.map((item) => {
4362
4362
  if (item.String && item.String.sval) {
4363
- return item.String.sval;
4363
+ return QuoteUtils.quoteIdentifier(item.String.sval);
4364
4364
  }
4365
4365
  return this.visit(item, context);
4366
4366
  });
@@ -6657,7 +6657,13 @@ export class Deparser {
6657
6657
  }
6658
6658
  else if (node.objtype === 'OBJECT_POLICY') {
6659
6659
  // Handle POLICY syntax: COMMENT ON POLICY policy_name ON table_name IS 'comment'
6660
- if (objectParts.length === 2) {
6660
+ if (objectParts.length === 3) {
6661
+ const [schema, table, policy] = objectParts;
6662
+ output.push(policy);
6663
+ output.push('ON');
6664
+ output.push(`${schema}.${table}`);
6665
+ }
6666
+ else if (objectParts.length === 2) {
6661
6667
  const [table, policy] = objectParts;
6662
6668
  output.push(policy);
6663
6669
  output.push('ON');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pgsql-deparser",
3
- "version": "18.4.0",
3
+ "version": "18.4.2",
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.2.0",
56
+ "libpg-query": "18.2.1",
57
57
  "makage": "^0.5.1"
58
58
  },
59
59
  "dependencies": {
60
60
  "@pgsql/quotes": "18.2.4",
61
61
  "@pgsql/types": "^18.0.0"
62
62
  },
63
- "gitHead": "2335550b66a3f114cf2cdbad500990b514256dd2"
63
+ "gitHead": "d49ec05b871e46de411a2af1630c234d4a2bb38f"
64
64
  }