sql_beautifier 0.10.1 → 0.10.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/sql_beautifier/insert_query.rb +12 -1
- data/lib/sql_beautifier/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 918b0bcf08b9f13dabc26250b303f2b35244cf996877939ac6c31ef7d263dd24
|
|
4
|
+
data.tar.gz: b8daaffc147aaf1556823c3bbc9ca95efdf5070a0747638b2dcc2af14b090e0e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3e9188e453a6055bbd79f7c1b4eb0b9aed091a7123d3ce83613e64a82629898022c090845fa36f6a68ff7a51cb692ad97b07dae55b3f1ec5927d196daa267ed7
|
|
7
|
+
data.tar.gz: 89a38090f7fd926e77a54d46d340a50d7b45bd461f49eda0fda865d6801f62ad8ccac2c751f4535cffd6418f1e2f9146f43fd9573e398bcb5113eb01ab022a5e
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
## [X.X.X] - YYYY-MM-DD
|
|
4
4
|
|
|
5
|
+
## [0.10.2] - 2026-03-30
|
|
6
|
+
|
|
7
|
+
- Fix `INSERT INTO ... (columns) (SELECT ...)` not being recognized — `InsertQuery.parse_body` now unwraps parenthesized SELECT subqueries, supporting PostgreSQL's valid `INSERT INTO table (cols) (SELECT ...)` syntax
|
|
8
|
+
|
|
5
9
|
## [0.10.1] - 2026-03-30
|
|
6
10
|
|
|
7
11
|
- Fix nested subquery indentation growing excessively at each depth level — `subquery_base_indent_for` was adding the parent formatter's `depth` to the base indent calculation for subqueries on `from`/`where` lines, double-counting indentation that the parent's `format_as_subquery` would also apply; the method now computes base indentation relative to column 0 of the clause text
|
|
@@ -73,6 +73,8 @@ module SqlBeautifier
|
|
|
73
73
|
remaining = normalized_sql[scanner.position..].strip
|
|
74
74
|
scanner.advance!(normalized_sql.length - scanner.position)
|
|
75
75
|
|
|
76
|
+
remaining = unwrap_parenthesized_select(remaining)
|
|
77
|
+
|
|
76
78
|
values_rows = nil
|
|
77
79
|
select_sql = nil
|
|
78
80
|
on_conflict_clause = nil
|
|
@@ -91,6 +93,15 @@ module SqlBeautifier
|
|
|
91
93
|
[values_rows, select_sql, on_conflict_clause, returning_clause]
|
|
92
94
|
end
|
|
93
95
|
|
|
96
|
+
def self.unwrap_parenthesized_select(text)
|
|
97
|
+
return text unless Tokenizer.outer_parentheses_wrap_all?(text)
|
|
98
|
+
|
|
99
|
+
inner_content = Util.strip_outer_parentheses(text)
|
|
100
|
+
return text unless Scanner.new(inner_content).keyword_at?("select")
|
|
101
|
+
|
|
102
|
+
inner_content
|
|
103
|
+
end
|
|
104
|
+
|
|
94
105
|
def self.split_values_tail(values_text)
|
|
95
106
|
rows, remaining_text = scan_value_rows(values_text)
|
|
96
107
|
return [nil, nil, nil] if rows.empty?
|
|
@@ -178,7 +189,7 @@ module SqlBeautifier
|
|
|
178
189
|
Tokenizer.find_top_level_keyword(text, keyword)
|
|
179
190
|
end
|
|
180
191
|
|
|
181
|
-
private_class_method :parse_column_list, :parse_body, :split_values_tail, :scan_value_rows, :split_select_tail, :split_on_conflict_and_returning, :find_top_level_keyword_position
|
|
192
|
+
private_class_method :parse_column_list, :parse_body, :unwrap_parenthesized_select, :split_values_tail, :scan_value_rows, :split_select_tail, :split_on_conflict_and_returning, :find_top_level_keyword_position
|
|
182
193
|
|
|
183
194
|
private
|
|
184
195
|
|