pgsql-deparser 17.16.0 → 17.17.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/deparser.js +14 -5
- package/esm/deparser.js +14 -5
- package/package.json +2 -2
package/deparser.js
CHANGED
|
@@ -508,7 +508,9 @@ class Deparser {
|
|
|
508
508
|
output.push('VALUES');
|
|
509
509
|
const lists = list_utils_1.ListUtils.unwrapList(node.valuesLists).map(list => {
|
|
510
510
|
const values = list_utils_1.ListUtils.unwrapList(list).map(val => this.visit(val, context));
|
|
511
|
-
|
|
511
|
+
// Put each value on its own line for pretty printing
|
|
512
|
+
const indentedValues = values.map(val => context.indent(val));
|
|
513
|
+
return '(\n' + indentedValues.join(',\n') + '\n)';
|
|
512
514
|
});
|
|
513
515
|
const indentedTuples = lists.map(tuple => {
|
|
514
516
|
if (this.containsMultilineStringLiteral(tuple)) {
|
|
@@ -1021,7 +1023,14 @@ class Deparser {
|
|
|
1021
1023
|
else {
|
|
1022
1024
|
const updateContext = context.spawn('UpdateStmt', { update: true });
|
|
1023
1025
|
const targets = targetList.map(target => this.visit(target, updateContext));
|
|
1024
|
-
|
|
1026
|
+
if (context.isPretty()) {
|
|
1027
|
+
// Put each assignment on its own line for pretty printing
|
|
1028
|
+
const indentedTargets = targets.map(target => context.indent(target));
|
|
1029
|
+
output.push('\n' + indentedTargets.join(',\n'));
|
|
1030
|
+
}
|
|
1031
|
+
else {
|
|
1032
|
+
output.push(targets.join(', '));
|
|
1033
|
+
}
|
|
1025
1034
|
}
|
|
1026
1035
|
}
|
|
1027
1036
|
if (node.onConflictClause.whereClause) {
|
|
@@ -2055,7 +2064,7 @@ class Deparser {
|
|
|
2055
2064
|
if (size != null) {
|
|
2056
2065
|
return 'char';
|
|
2057
2066
|
}
|
|
2058
|
-
return '
|
|
2067
|
+
return 'bpchar';
|
|
2059
2068
|
case 'varchar':
|
|
2060
2069
|
return 'varchar';
|
|
2061
2070
|
case 'numeric':
|
|
@@ -2069,7 +2078,7 @@ class Deparser {
|
|
|
2069
2078
|
case 'int8':
|
|
2070
2079
|
return 'bigint';
|
|
2071
2080
|
case 'real':
|
|
2072
|
-
return '
|
|
2081
|
+
return 'float4';
|
|
2073
2082
|
case 'time':
|
|
2074
2083
|
return 'time';
|
|
2075
2084
|
case 'timestamp':
|
|
@@ -2079,7 +2088,7 @@ class Deparser {
|
|
|
2079
2088
|
case 'bit':
|
|
2080
2089
|
return 'bit';
|
|
2081
2090
|
default:
|
|
2082
|
-
return
|
|
2091
|
+
return typeName;
|
|
2083
2092
|
}
|
|
2084
2093
|
}
|
|
2085
2094
|
isPgCatalogType(typeName) {
|
package/esm/deparser.js
CHANGED
|
@@ -505,7 +505,9 @@ export class Deparser {
|
|
|
505
505
|
output.push('VALUES');
|
|
506
506
|
const lists = ListUtils.unwrapList(node.valuesLists).map(list => {
|
|
507
507
|
const values = ListUtils.unwrapList(list).map(val => this.visit(val, context));
|
|
508
|
-
|
|
508
|
+
// Put each value on its own line for pretty printing
|
|
509
|
+
const indentedValues = values.map(val => context.indent(val));
|
|
510
|
+
return '(\n' + indentedValues.join(',\n') + '\n)';
|
|
509
511
|
});
|
|
510
512
|
const indentedTuples = lists.map(tuple => {
|
|
511
513
|
if (this.containsMultilineStringLiteral(tuple)) {
|
|
@@ -1018,7 +1020,14 @@ export class Deparser {
|
|
|
1018
1020
|
else {
|
|
1019
1021
|
const updateContext = context.spawn('UpdateStmt', { update: true });
|
|
1020
1022
|
const targets = targetList.map(target => this.visit(target, updateContext));
|
|
1021
|
-
|
|
1023
|
+
if (context.isPretty()) {
|
|
1024
|
+
// Put each assignment on its own line for pretty printing
|
|
1025
|
+
const indentedTargets = targets.map(target => context.indent(target));
|
|
1026
|
+
output.push('\n' + indentedTargets.join(',\n'));
|
|
1027
|
+
}
|
|
1028
|
+
else {
|
|
1029
|
+
output.push(targets.join(', '));
|
|
1030
|
+
}
|
|
1022
1031
|
}
|
|
1023
1032
|
}
|
|
1024
1033
|
if (node.onConflictClause.whereClause) {
|
|
@@ -2052,7 +2061,7 @@ export class Deparser {
|
|
|
2052
2061
|
if (size != null) {
|
|
2053
2062
|
return 'char';
|
|
2054
2063
|
}
|
|
2055
|
-
return '
|
|
2064
|
+
return 'bpchar';
|
|
2056
2065
|
case 'varchar':
|
|
2057
2066
|
return 'varchar';
|
|
2058
2067
|
case 'numeric':
|
|
@@ -2066,7 +2075,7 @@ export class Deparser {
|
|
|
2066
2075
|
case 'int8':
|
|
2067
2076
|
return 'bigint';
|
|
2068
2077
|
case 'real':
|
|
2069
|
-
return '
|
|
2078
|
+
return 'float4';
|
|
2070
2079
|
case 'time':
|
|
2071
2080
|
return 'time';
|
|
2072
2081
|
case 'timestamp':
|
|
@@ -2076,7 +2085,7 @@ export class Deparser {
|
|
|
2076
2085
|
case 'bit':
|
|
2077
2086
|
return 'bit';
|
|
2078
2087
|
default:
|
|
2079
|
-
return
|
|
2088
|
+
return typeName;
|
|
2080
2089
|
}
|
|
2081
2090
|
}
|
|
2082
2091
|
isPgCatalogType(typeName) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pgsql-deparser",
|
|
3
|
-
"version": "17.
|
|
3
|
+
"version": "17.17.0",
|
|
4
4
|
"author": "Constructive <developers@constructive.io>",
|
|
5
5
|
"description": "PostgreSQL AST Deparser",
|
|
6
6
|
"main": "index.js",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@pgsql/types": "^17.6.2"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "529f487216d0ca3d93b1dea2e6411a1e5432d183"
|
|
64
64
|
}
|