Skip to content

Commit ed0445a

Browse files
committed
Added support for processing .xz and .gz files
1 parent 2d225f9 commit ed0445a

File tree

1 file changed

+62
-6
lines changed

1 file changed

+62
-6
lines changed

README.md

Lines changed: 62 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -165,14 +165,16 @@ Rules are written in YAML and matched against each SQL line. Example:
165165
> 💡 This is also the default rule if you don't provide `--rules` param.
166166
167167
```yaml
168+
# postgres_to_crdb.yaml — Comprehensive CRDB Compatibility Rules based on https://www.cockroachlabs.com/docs/v25.2/sql-feature-support
169+
168170
- id: malformed_dml_statements
169171
match: '^(SELECT|INSERT|UPDATE|DELETE FROM)\s*$'
170172
message: "Possibly malformed or incomplete SQL statement"
171173
level: warning
172174
tags: [syntax]
173175

174176
- id: special_char_in_identifier
175-
match: '"[^"]*#\w*"'
177+
match: '"[^\"]*#\w*"'
176178
message: "Table name contains unsupported special character (#)"
177179
level: error
178180
tags: [table, identifier]
@@ -183,11 +185,65 @@ Rules are written in YAML and matched against each SQL line. Example:
183185
level: error
184186
tags: [function]
185187

186-
#- id: low_token_sql
187-
#match: '^(\S+\s*){1,2}$'
188-
#message: "Extremely short SQL likely malformed"
189-
#level: warning
190-
#tags: [syntax]
188+
- id: with_cte
189+
match: '^\s*WITH\s+'
190+
message: "CTE (WITH clause) detected"
191+
level: warning
192+
tags: [cte, syntax]
193+
194+
- id: upsert_syntax
195+
match: '^\s*UPSERT\s+'
196+
message: "UPSERT syntax (CockroachDB supports but should be reviewed)"
197+
level: info
198+
tags: [upsert, insert]
199+
200+
- id: json_ops
201+
match: '->|->>|::json[b]?' # Look for JSON navigation or cast
202+
message: "JSON/JSONB usage detected"
203+
level: info
204+
tags: [json]
205+
206+
- id: row_values
207+
match: '\(.*\).*IN\s*\(' # e.g., WHERE (a, b) IN ((1, 2))
208+
message: "ROW VALUES in IN clause"
209+
level: warning
210+
tags: [rowvalues, comparison]
211+
212+
- id: window_function
213+
match: '\bOVER\s*\('
214+
message: "Window function usage (e.g., RANK, ROW_NUMBER)"
215+
level: info
216+
tags: [window, analytics]
217+
218+
- id: set_ops
219+
match: '\s+(UNION|INTERSECT|EXCEPT)\s+'
220+
message: "Set operation (UNION, INTERSECT, EXCEPT)"
221+
level: info
222+
tags: [setops]
223+
224+
- id: case_expr
225+
match: '\bCASE\b.*\bWHEN\b.*\bTHEN\b'
226+
message: "CASE expression detected"
227+
level: info
228+
tags: [case, conditional]
229+
230+
- id: time_interval
231+
match: 'INTERVAL\s+[''\"]'
232+
message: "TIME INTERVAL expression"
233+
level: info
234+
tags: [interval, time]
235+
236+
- id: group_by_rollup
237+
match: 'GROUP BY ROLLUP\('
238+
message: "ROLLUP clause used"
239+
level: warning
240+
tags: [aggregation, rollup]
241+
242+
- id: filter_clause
243+
match: 'FILTER\s*\(\s*WHERE'
244+
message: "FILTER clause used in aggregation"
245+
level: warning
246+
tags: [aggregation, filter]
191247
```
192248
193249
> 📦 Multiple rule sets can be created to target different SQL dialects (e.g., `postgres_to_crdb.yaml`, `mysql_to_crdb.yaml`, etc.)

0 commit comments

Comments
 (0)