polyglot-sql 0.5.10__tar.gz → 0.5.12__tar.gz

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.
Files changed (185) hide show
  1. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/Cargo.lock +5 -5
  2. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/Cargo.toml +1 -1
  3. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/PKG-INFO +1 -1
  4. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/Cargo.toml +1 -1
  5. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/duckdb.rs +0 -13
  6. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/mod.rs +159 -2
  7. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/postgres.rs +0 -16
  8. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/expressions.rs +5 -2
  9. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/generator.rs +152 -6
  10. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/parser.rs +367 -80
  11. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/tokens.rs +9 -0
  12. polyglot_sql-0.5.12/crates/polyglot-sql/tests/create_view_security_comment_regression.rs +102 -0
  13. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/issue227_strict_unsupported.rs +25 -0
  14. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/tsql_regression.rs +109 -2
  15. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/README.md +0 -0
  16. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/README.md +0 -0
  17. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/benches/in_list.rs +0 -0
  18. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/benches/parsing.rs +0 -0
  19. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/benches/rust_parsing.rs +0 -0
  20. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/benches/transpile.rs +0 -0
  21. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/examples/basic_usage.rs +0 -0
  22. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/examples/bench_json.rs +0 -0
  23. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/ast_json.rs +0 -0
  24. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/ast_transforms.rs +0 -0
  25. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/builder.rs +0 -0
  26. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/athena.rs +0 -0
  27. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/bigquery.rs +0 -0
  28. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/clickhouse.rs +0 -0
  29. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/cockroachdb.rs +0 -0
  30. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/databricks.rs +0 -0
  31. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/datafusion.rs +0 -0
  32. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/doris.rs +0 -0
  33. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/dremio.rs +0 -0
  34. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/drill.rs +0 -0
  35. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/druid.rs +0 -0
  36. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/dune.rs +0 -0
  37. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/exasol.rs +0 -0
  38. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/fabric.rs +0 -0
  39. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/generic.rs +0 -0
  40. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/hive.rs +0 -0
  41. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/materialize.rs +0 -0
  42. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/mysql.rs +0 -0
  43. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/oracle.rs +0 -0
  44. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/presto.rs +0 -0
  45. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/redshift.rs +0 -0
  46. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/risingwave.rs +0 -0
  47. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/singlestore.rs +0 -0
  48. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/snowflake.rs +0 -0
  49. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/solr.rs +0 -0
  50. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/spark.rs +0 -0
  51. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/sqlite.rs +0 -0
  52. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/starrocks.rs +0 -0
  53. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/tableau.rs +0 -0
  54. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/teradata.rs +0 -0
  55. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/tidb.rs +0 -0
  56. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/trino.rs +0 -0
  57. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/tsql.rs +0 -0
  58. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/diff.rs +0 -0
  59. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/error.rs +0 -0
  60. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/function_catalog.rs +0 -0
  61. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/function_registry.rs +0 -0
  62. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/helper.rs +0 -0
  63. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/lib.rs +0 -0
  64. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/lineage.rs +0 -0
  65. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/openlineage.rs +0 -0
  66. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/optimizer/annotate_types.rs +0 -0
  67. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/optimizer/canonicalize.rs +0 -0
  68. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/optimizer/eliminate_ctes.rs +0 -0
  69. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/optimizer/eliminate_joins.rs +0 -0
  70. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/optimizer/isolate_table_selects.rs +0 -0
  71. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/optimizer/mod.rs +0 -0
  72. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/optimizer/normalize.rs +0 -0
  73. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/optimizer/normalize_identifiers.rs +0 -0
  74. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/optimizer/optimize_joins.rs +0 -0
  75. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/optimizer/optimizer.rs +0 -0
  76. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/optimizer/pushdown_predicates.rs +0 -0
  77. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/optimizer/pushdown_projections.rs +0 -0
  78. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/optimizer/qualify_columns.rs +0 -0
  79. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/optimizer/qualify_tables.rs +0 -0
  80. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/optimizer/simplify.rs +0 -0
  81. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/optimizer/subquery.rs +0 -0
  82. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/planner.rs +0 -0
  83. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/query_analysis.rs +0 -0
  84. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/resolver.rs +0 -0
  85. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/schema.rs +0 -0
  86. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/scope.rs +0 -0
  87. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/time.rs +0 -0
  88. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/transforms.rs +0 -0
  89. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/traversal.rs +0 -0
  90. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/trie.rs +0 -0
  91. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/validation/tests.rs +0 -0
  92. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/validation.rs +0 -0
  93. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/analyze_failures.rs +0 -0
  94. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/clickhouse_regression.rs +0 -0
  95. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/common/known_failures.rs +0 -0
  96. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/common/mod.rs +0 -0
  97. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/common/test_data.rs +0 -0
  98. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/common/test_runner.rs +0 -0
  99. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/custom_clickhouse_coverage.rs +0 -0
  100. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/custom_clickhouse_parser.rs +0 -0
  101. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/custom_dialect.rs +0 -0
  102. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/custom_dialect_tests.rs +0 -0
  103. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/custom_fixtures/datafusion/ddl.json +0 -0
  104. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/custom_fixtures/datafusion/dml.json +0 -0
  105. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/custom_fixtures/datafusion/functions.json +0 -0
  106. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/custom_fixtures/datafusion/identity.json +0 -0
  107. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/custom_fixtures/datafusion/operators.json +0 -0
  108. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/custom_fixtures/datafusion/select.json +0 -0
  109. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/custom_fixtures/datafusion/transpilation.json +0 -0
  110. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/custom_fixtures/datafusion/types.json +0 -0
  111. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/data_type_api.rs +0 -0
  112. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/deep_nesting_regression.rs +0 -0
  113. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/dialect_matrix.rs +0 -0
  114. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/error_handling.rs +0 -0
  115. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/fabric_regression.rs +0 -0
  116. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/fabric_tpch_regression.rs +0 -0
  117. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/identity_roundtrip.rs +0 -0
  118. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/issue201_regression_test.rs +0 -0
  119. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/issue210_regression_test.rs +0 -0
  120. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/issue226_regression_test.rs +0 -0
  121. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/postgres_sqlite_regression.rs +0 -0
  122. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/query_analysis.rs +0 -0
  123. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/query_analysis_regression.rs +0 -0
  124. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/snowflake_regression_test.rs +0 -0
  125. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/sqlglot_compat.rs +0 -0
  126. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/sqlglot_dialect_identity.rs +0 -0
  127. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/sqlglot_identity.rs +0 -0
  128. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/sqlglot_identity_detailed.rs +0 -0
  129. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/sqlglot_parser.rs +0 -0
  130. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/sqlglot_pretty.rs +0 -0
  131. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/sqlglot_transpilation.rs +0 -0
  132. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/sqlglot_transpile.rs +0 -0
  133. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/tpch_transpile_stack.rs +0 -0
  134. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/transform_regression.rs +0 -0
  135. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql-function-catalogs/Cargo.toml +0 -0
  136. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql-function-catalogs/README.md +0 -0
  137. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql-function-catalogs/src/clickhouse.rs +0 -0
  138. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql-function-catalogs/src/duckdb.rs +0 -0
  139. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql-function-catalogs/src/lib.rs +0 -0
  140. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql-function-catalogs/tools/clickhouse/extract_functions.py +0 -0
  141. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql-function-catalogs/tools/duckdb/extract_functions.py +0 -0
  142. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/Cargo.toml +0 -0
  143. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/README.md +0 -0
  144. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/docs/api.md +0 -0
  145. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/docs/index.md +0 -0
  146. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/mkdocs.yml +0 -0
  147. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/src/annotate_types.rs +0 -0
  148. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/src/dialects.rs +0 -0
  149. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/src/diff.rs +0 -0
  150. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/src/errors.rs +0 -0
  151. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/src/expr.rs +0 -0
  152. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/src/expr_types.rs +0 -0
  153. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/src/format.rs +0 -0
  154. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/src/generate.rs +0 -0
  155. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/src/helpers.rs +0 -0
  156. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/src/lib.rs +0 -0
  157. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/src/lineage.rs +0 -0
  158. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/src/openlineage.rs +0 -0
  159. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/src/optimize.rs +0 -0
  160. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/src/parse.rs +0 -0
  161. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/src/query_analysis.rs +0 -0
  162. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/src/tokenize.rs +0 -0
  163. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/src/transforms.rs +0 -0
  164. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/src/transpile.rs +0 -0
  165. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/src/types.rs +0 -0
  166. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/src/validate.rs +0 -0
  167. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/tests/conftest.py +0 -0
  168. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/tests/test_compat.py +0 -0
  169. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/tests/test_dialects.py +0 -0
  170. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/tests/test_diff.py +0 -0
  171. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/tests/test_expression.py +0 -0
  172. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/tests/test_format.py +0 -0
  173. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/tests/test_generate.py +0 -0
  174. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/tests/test_lineage.py +0 -0
  175. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/tests/test_optimize.py +0 -0
  176. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/tests/test_parse.py +0 -0
  177. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/tests/test_query_analysis.py +0 -0
  178. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/tests/test_transforms.py +0 -0
  179. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/tests/test_transpile.py +0 -0
  180. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/tests/test_validate.py +0 -0
  181. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/uv.lock +0 -0
  182. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/pyproject.toml +0 -0
  183. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/python/polyglot_sql/__init__.py +0 -0
  184. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/python/polyglot_sql/__init__.pyi +0 -0
  185. {polyglot_sql-0.5.10 → polyglot_sql-0.5.12}/python/polyglot_sql/py.typed +0 -0
@@ -605,7 +605,7 @@ dependencies = [
605
605
 
606
606
  [[package]]
607
607
  name = "polyglot-sql"
608
- version = "0.5.10"
608
+ version = "0.5.12"
609
609
  dependencies = [
610
610
  "criterion",
611
611
  "once_cell",
@@ -621,7 +621,7 @@ dependencies = [
621
621
 
622
622
  [[package]]
623
623
  name = "polyglot-sql-ffi"
624
- version = "0.5.10"
624
+ version = "0.5.12"
625
625
  dependencies = [
626
626
  "cbindgen",
627
627
  "polyglot-sql",
@@ -631,11 +631,11 @@ dependencies = [
631
631
 
632
632
  [[package]]
633
633
  name = "polyglot-sql-function-catalogs"
634
- version = "0.5.10"
634
+ version = "0.5.12"
635
635
 
636
636
  [[package]]
637
637
  name = "polyglot-sql-python"
638
- version = "0.5.10"
638
+ version = "0.5.12"
639
639
  dependencies = [
640
640
  "polyglot-sql",
641
641
  "pyo3",
@@ -646,7 +646,7 @@ dependencies = [
646
646
 
647
647
  [[package]]
648
648
  name = "polyglot-sql-wasm"
649
- version = "0.5.10"
649
+ version = "0.5.12"
650
650
  dependencies = [
651
651
  "console_error_panic_hook",
652
652
  "js-sys",
@@ -6,7 +6,7 @@ exclude = [
6
6
  ]
7
7
 
8
8
  [workspace.package]
9
- version = "0.5.10"
9
+ version = "0.5.12"
10
10
  edition = "2021"
11
11
  license = "MIT"
12
12
  authors = ["polyglot contributors"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: polyglot-sql
3
- Version: 0.5.10
3
+ Version: 0.5.12
4
4
  Classifier: Development Status :: 4 - Beta
5
5
  Classifier: Intended Audience :: Developers
6
6
  Classifier: License :: OSI Approved :: MIT License
@@ -106,7 +106,7 @@ thiserror = { workspace = true }
106
106
  unicode-segmentation = { workspace = true }
107
107
  stacker = { version = "0.1", optional = true }
108
108
  ts-rs = { version = "12.0", features = ["serde-compat"], optional = true }
109
- polyglot-sql-function-catalogs = { path = "../polyglot-sql-function-catalogs", version = "0.5.10", optional = true, default-features = false }
109
+ polyglot-sql-function-catalogs = { path = "../polyglot-sql-function-catalogs", version = "0.5.12", optional = true, default-features = false }
110
110
 
111
111
  [dev-dependencies]
112
112
  pretty_assertions = "1.4"
@@ -244,19 +244,6 @@ impl DialectImpl for DuckDBDialect {
244
244
  // UNNEST is native to DuckDB
245
245
  Expression::Unnest(f) => Ok(Expression::Unnest(f)),
246
246
 
247
- // ArrayContainedBy (<@) -> ArrayContainsAll (@>) with swapped operands
248
- // a <@ b becomes b @> a
249
- Expression::ArrayContainedBy(op) => {
250
- Ok(Expression::ArrayContainsAll(Box::new(BinaryOp {
251
- left: op.right,
252
- right: op.left,
253
- left_comments: Vec::new(),
254
- operator_comments: Vec::new(),
255
- trailing_comments: Vec::new(),
256
- inferred_type: None,
257
- })))
258
- }
259
-
260
247
  // DATE_ADD -> date + INTERVAL in DuckDB
261
248
  Expression::DateAdd(f) => {
262
249
  // Reconstruct INTERVAL expression from value and unit
@@ -4879,6 +4879,15 @@ impl Dialect {
4879
4879
  Self::push_unsupported_diagnostic(&mut diagnostics, "ARRAY_AGG");
4880
4880
  }
4881
4881
 
4882
+ if matches!(target, DialectType::TSQL | DialectType::Fabric)
4883
+ && Self::node_is_regex_predicate(node)
4884
+ {
4885
+ Self::push_unsupported_diagnostic(
4886
+ &mut diagnostics,
4887
+ "regular expression predicates",
4888
+ );
4889
+ }
4890
+
4882
4891
  if matches!(source, DialectType::PostgreSQL | DialectType::CockroachDB)
4883
4892
  && !matches!(target, DialectType::PostgreSQL | DialectType::CockroachDB)
4884
4893
  {
@@ -5018,6 +5027,15 @@ impl Dialect {
5018
5027
  matches!(expr, Expression::ArrayAgg(_)) || Self::node_is_function_named(expr, "ARRAY_AGG")
5019
5028
  }
5020
5029
 
5030
+ fn node_is_regex_predicate(expr: &Expression) -> bool {
5031
+ matches!(
5032
+ expr,
5033
+ Expression::SimilarTo(_) | Expression::RegexpLike(_) | Expression::RegexpILike(_)
5034
+ ) || Self::node_is_function_named(expr, "REGEXP_LIKE")
5035
+ || Self::node_is_function_named(expr, "REGEXP_I_LIKE")
5036
+ || Self::node_is_function_named(expr, "REGEXP_ILIKE")
5037
+ }
5038
+
5021
5039
  fn node_is_function_named(expr: &Expression, name: &str) -> bool {
5022
5040
  match expr {
5023
5041
  Expression::Function(function) => function.name.eq_ignore_ascii_case(name),
@@ -8911,7 +8929,7 @@ impl Dialect {
8911
8929
  | "SAFE_ADD" | "SAFE_SUBTRACT" | "SAFE_MULTIPLY"
8912
8930
  | "SAFE_CAST"
8913
8931
  | "GENERATE_DATE_ARRAY"
8914
- | "PARSE_DATE" | "PARSE_TIMESTAMP"
8932
+ | "PARSE_DATE" | "PARSE_DATETIME" | "PARSE_TIMESTAMP"
8915
8933
  | "FORMAT_DATE" | "FORMAT_DATETIME" | "FORMAT_TIMESTAMP"
8916
8934
  | "ARRAY_CONCAT"
8917
8935
  | "JSON_QUERY" | "JSON_VALUE_ARRAY"
@@ -9040,7 +9058,8 @@ impl Dialect {
9040
9058
  | "CONVERT" | "TRY_CONVERT"
9041
9059
  | "STRFTIME" | "STRPTIME"
9042
9060
  | "DATE_FORMAT" | "FORMAT_DATE"
9043
- | "PARSE_TIMESTAMP" | "PARSE_DATE"
9061
+ | "PARSE_TIMESTAMP" | "PARSE_DATETIME" | "PARSE_DATE"
9062
+ | "FROM_ISO8601_TIMESTAMP" | "FROM_ISO8601_DATE"
9044
9063
  | "FROM_BASE64" | "TO_BASE64"
9045
9064
  | "GETDATE"
9046
9065
  | "TO_HEX" | "FROM_HEX" | "UNHEX" | "HEX"
@@ -14569,6 +14588,108 @@ impl Dialect {
14569
14588
  )))),
14570
14589
  }
14571
14590
  }
14591
+ // BigQuery PARSE_DATETIME(format, value) -> target-specific parsing calls.
14592
+ "PARSE_DATETIME"
14593
+ if matches!(source, DialectType::BigQuery) && f.args.len() == 2 =>
14594
+ {
14595
+ fn expand_bigquery_datetime_format(expr: Expression) -> Expression {
14596
+ match expr {
14597
+ Expression::Literal(lit) => match lit.as_ref() {
14598
+ Literal::String(s) => Expression::string(
14599
+ s.replace("%F", "%Y-%m-%d")
14600
+ .replace("%T", "%H:%M:%S"),
14601
+ ),
14602
+ _ => Expression::Literal(lit),
14603
+ },
14604
+ other => other,
14605
+ }
14606
+ }
14607
+
14608
+ let mut args = f.args;
14609
+ let format = expand_bigquery_datetime_format(args.remove(0));
14610
+ let value = args.remove(0);
14611
+ match target {
14612
+ DialectType::DuckDB => {
14613
+ let value_with_year = Expression::Concat(Box::new(
14614
+ crate::expressions::BinaryOp::new(
14615
+ Expression::string("1970 "),
14616
+ value,
14617
+ ),
14618
+ ));
14619
+ let format_with_year = Expression::Concat(Box::new(
14620
+ crate::expressions::BinaryOp::new(
14621
+ Expression::string("%Y "),
14622
+ format,
14623
+ ),
14624
+ ));
14625
+ Ok(Expression::Function(Box::new(Function::new(
14626
+ "STRPTIME".to_string(),
14627
+ vec![value_with_year, format_with_year],
14628
+ ))))
14629
+ }
14630
+ DialectType::Snowflake => {
14631
+ Ok(Expression::Function(Box::new(Function::new(
14632
+ "PARSE_DATETIME".to_string(),
14633
+ vec![value, format],
14634
+ ))))
14635
+ }
14636
+ _ => Ok(Expression::Function(Box::new(Function::new(
14637
+ "PARSE_DATETIME".to_string(),
14638
+ vec![format, value],
14639
+ )))),
14640
+ }
14641
+ }
14642
+ // Presto/Trino ISO-8601 helpers become casts outside Presto-family targets.
14643
+ "FROM_ISO8601_TIMESTAMP"
14644
+ if matches!(
14645
+ source,
14646
+ DialectType::Presto | DialectType::Trino | DialectType::Athena
14647
+ ) && f.args.len() == 1
14648
+ && !matches!(
14649
+ target,
14650
+ DialectType::Presto
14651
+ | DialectType::Trino
14652
+ | DialectType::Athena
14653
+ ) =>
14654
+ {
14655
+ Ok(Expression::Cast(Box::new(crate::expressions::Cast {
14656
+ this: f.args.into_iter().next().unwrap(),
14657
+ to: DataType::Timestamp {
14658
+ precision: None,
14659
+ timezone: matches!(
14660
+ target,
14661
+ DialectType::DuckDB | DialectType::Snowflake
14662
+ ),
14663
+ },
14664
+ trailing_comments: Vec::new(),
14665
+ double_colon_syntax: false,
14666
+ format: None,
14667
+ default: None,
14668
+ inferred_type: None,
14669
+ })))
14670
+ }
14671
+ "FROM_ISO8601_DATE"
14672
+ if matches!(
14673
+ source,
14674
+ DialectType::Presto | DialectType::Trino | DialectType::Athena
14675
+ ) && f.args.len() == 1
14676
+ && !matches!(
14677
+ target,
14678
+ DialectType::Presto
14679
+ | DialectType::Trino
14680
+ | DialectType::Athena
14681
+ ) =>
14682
+ {
14683
+ Ok(Expression::Cast(Box::new(crate::expressions::Cast {
14684
+ this: f.args.into_iter().next().unwrap(),
14685
+ to: DataType::Date,
14686
+ trailing_comments: Vec::new(),
14687
+ double_colon_syntax: false,
14688
+ format: None,
14689
+ default: None,
14690
+ inferred_type: None,
14691
+ })))
14692
+ }
14572
14693
  // MAP(keys_array, vals_array) from Presto (2-arg form) -> target-specific
14573
14694
  "MAP"
14574
14695
  if f.args.len() == 2
@@ -14706,6 +14827,7 @@ impl Dialect {
14706
14827
  | DialectType::Spark
14707
14828
  | DialectType::Databricks
14708
14829
  | DialectType::ClickHouse
14830
+ | DialectType::StarRocks
14709
14831
  ) =>
14710
14832
  {
14711
14833
  let args = f.args;
@@ -37095,6 +37217,41 @@ impl Dialect {
37095
37217
  }
37096
37218
  }
37097
37219
 
37220
+ // PARSE_DATETIME(format, str) -> target-specific
37221
+ "PARSE_DATETIME" if args.len() == 2 => {
37222
+ let format = args.remove(0);
37223
+ let str_expr = args.remove(0);
37224
+ let c_format = Self::bq_format_to_duckdb(&format);
37225
+ match target {
37226
+ DialectType::DuckDB => {
37227
+ // DuckDB STRPTIME needs a date-bearing format for DATETIME parsing.
37228
+ let str_with_year = Expression::Concat(Box::new(BinaryOp::new(
37229
+ Expression::string("1970 "),
37230
+ str_expr,
37231
+ )));
37232
+ let format_with_year = Expression::Concat(Box::new(BinaryOp::new(
37233
+ Expression::string("%Y "),
37234
+ c_format,
37235
+ )));
37236
+ Ok(Expression::Function(Box::new(Function::new(
37237
+ "STRPTIME".to_string(),
37238
+ vec![str_with_year, format_with_year],
37239
+ ))))
37240
+ }
37241
+ DialectType::Snowflake => {
37242
+ // SQLGlot emits PARSE_DATETIME(value, format) with expanded C-style format tokens.
37243
+ Ok(Expression::Function(Box::new(Function::new(
37244
+ "PARSE_DATETIME".to_string(),
37245
+ vec![str_expr, c_format],
37246
+ ))))
37247
+ }
37248
+ _ => Ok(Expression::Function(Box::new(Function::new(
37249
+ "PARSE_DATETIME".to_string(),
37250
+ vec![format, str_expr],
37251
+ )))),
37252
+ }
37253
+ }
37254
+
37098
37255
  // PARSE_TIMESTAMP(format, str) -> target-specific
37099
37256
  "PARSE_TIMESTAMP" if args.len() >= 2 => {
37100
37257
  let format = args.remove(0);
@@ -319,22 +319,6 @@ impl DialectImpl for PostgresDialect {
319
319
  }
320
320
  }
321
321
 
322
- // ============================================
323
- // ARRAY OPERATORS
324
- // ============================================
325
- // ArrayContainedBy (<@) -> ArrayContainsAll (@>) with swapped operands
326
- // a <@ b -> b @> a (PostgreSQL prefers @> syntax)
327
- Expression::ArrayContainedBy(op) => {
328
- Ok(Expression::ArrayContainsAll(Box::new(BinaryOp {
329
- left: op.right,
330
- right: op.left,
331
- left_comments: Vec::new(),
332
- operator_comments: Vec::new(),
333
- trailing_comments: Vec::new(),
334
- inferred_type: None,
335
- })))
336
- }
337
-
338
322
  // ============================================
339
323
  // REGEXP OPERATIONS (PostgreSQL uses ~ and ~* operators)
340
324
  // ============================================
@@ -8060,17 +8060,20 @@ impl DropTable {
8060
8060
  }
8061
8061
  }
8062
8062
 
8063
- /// UNDROP TABLE/SCHEMA/DATABASE statement (Snowflake, ClickHouse)
8063
+ /// UNDROP object statement (Snowflake, ClickHouse)
8064
8064
  #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8065
8065
  #[cfg_attr(feature = "bindings", derive(TS))]
8066
8066
  pub struct Undrop {
8067
- /// The object kind: "TABLE", "SCHEMA", or "DATABASE"
8067
+ /// The object kind, e.g. "TABLE", "SCHEMA", "DATABASE", "DYNAMIC TABLE"
8068
8068
  pub kind: String,
8069
8069
  /// The object name
8070
8070
  pub name: TableRef,
8071
8071
  /// IF EXISTS clause
8072
8072
  #[serde(default)]
8073
8073
  pub if_exists: bool,
8074
+ /// Snowflake: optional RENAME TO target
8075
+ #[serde(default, skip_serializing_if = "Option::is_none")]
8076
+ pub rename_to: Option<TableRef>,
8074
8077
  }
8075
8078
 
8076
8079
  /// ALTER TABLE statement
@@ -3269,10 +3269,10 @@ impl Generator {
3269
3269
  Expression::JSONBContainsAllTopKeys(op) => self.generate_binary_op(op, "?&"),
3270
3270
  Expression::JSONBContainsAnyTopKeys(op) => self.generate_binary_op(op, "?|"),
3271
3271
  Expression::JSONBContains(f) => {
3272
- // PostgreSQL JSONB contains key operator: a ? b
3272
+ // PostgreSQL JSONB contains key/path operators: a ? b, a @? b
3273
3273
  self.generate_expression(&f.this)?;
3274
3274
  self.write_space();
3275
- self.write("?");
3275
+ self.write(f.original_name.as_deref().unwrap_or("?"));
3276
3276
  self.write_space();
3277
3277
  self.generate_expression(&f.expression)
3278
3278
  }
@@ -3351,6 +3351,17 @@ impl Generator {
3351
3351
  Expression::TryCatch(try_catch) => self.generate_try_catch(try_catch),
3352
3352
  Expression::Command(cmd) => {
3353
3353
  self.write(&cmd.this);
3354
+ if matches!(self.config.dialect, Some(DialectType::ClickHouse))
3355
+ && cmd
3356
+ .this
3357
+ .trim_start()
3358
+ .get(..7)
3359
+ .is_some_and(|prefix| prefix.eq_ignore_ascii_case("EXPLAIN"))
3360
+ {
3361
+ for _ in 0..Self::missing_closing_parens_outside_quotes(&cmd.this) {
3362
+ self.write(")");
3363
+ }
3364
+ }
3354
3365
  Ok(())
3355
3366
  }
3356
3367
  Expression::Kill(kill) => {
@@ -10394,6 +10405,12 @@ impl Generator {
10394
10405
  }
10395
10406
  self.write_space();
10396
10407
  self.generate_table(&u.name)?;
10408
+ if let Some(rename_to) = &u.rename_to {
10409
+ self.write_space();
10410
+ self.write_keyword("RENAME TO");
10411
+ self.write_space();
10412
+ self.generate_table(rename_to)?;
10413
+ }
10397
10414
  Ok(())
10398
10415
  }
10399
10416
 
@@ -12817,7 +12834,7 @@ impl Generator {
12817
12834
  }
12818
12835
  self.write_keyword("RETURNS");
12819
12836
  self.write_space();
12820
- self.generate_data_type(return_type)?;
12837
+ self.generate_function_return_type(return_type)?;
12821
12838
  }
12822
12839
  } else {
12823
12840
  // RETURNS first (default)
@@ -12851,7 +12868,7 @@ impl Generator {
12851
12868
  if is_table_return {
12852
12869
  self.write_keyword("TABLE");
12853
12870
  } else {
12854
- self.generate_data_type(return_type)?;
12871
+ self.generate_function_return_type(return_type)?;
12855
12872
  }
12856
12873
  }
12857
12874
  }
@@ -12864,6 +12881,10 @@ impl Generator {
12864
12881
  self.config.dialect,
12865
12882
  Some(crate::dialects::DialectType::BigQuery)
12866
12883
  );
12884
+ let is_postgres = matches!(
12885
+ self.config.dialect,
12886
+ Some(crate::dialects::DialectType::PostgreSQL)
12887
+ );
12867
12888
  let property_order = if is_bigquery {
12868
12889
  // Move Options before As if both are present
12869
12890
  let mut reordered = Vec::new();
@@ -12891,6 +12912,18 @@ impl Generator {
12891
12912
  } else {
12892
12913
  cf.property_order.clone()
12893
12914
  }
12915
+ } else if is_postgres
12916
+ && cf.property_order.contains(&FunctionPropertyKind::As)
12917
+ && cf.property_order.contains(&FunctionPropertyKind::NullInput)
12918
+ {
12919
+ let mut reordered: Vec<_> = cf
12920
+ .property_order
12921
+ .iter()
12922
+ .copied()
12923
+ .filter(|prop| *prop != FunctionPropertyKind::As)
12924
+ .collect();
12925
+ reordered.push(FunctionPropertyKind::As);
12926
+ reordered
12894
12927
  } else {
12895
12928
  cf.property_order.clone()
12896
12929
  };
@@ -13120,6 +13153,22 @@ impl Generator {
13120
13153
  Ok(())
13121
13154
  }
13122
13155
 
13156
+ fn generate_function_return_type(&mut self, return_type: &DataType) -> Result<()> {
13157
+ if matches!(
13158
+ self.config.dialect,
13159
+ Some(crate::dialects::DialectType::PostgreSQL)
13160
+ ) {
13161
+ if let DataType::Custom { name } = return_type {
13162
+ if name.eq_ignore_ascii_case("integer") {
13163
+ self.write_keyword("INT");
13164
+ return Ok(());
13165
+ }
13166
+ }
13167
+ }
13168
+
13169
+ self.generate_data_type(return_type)
13170
+ }
13171
+
13123
13172
  /// Generate SET options for CREATE FUNCTION
13124
13173
  fn generate_function_set_options(&mut self, cf: &CreateFunction) -> Result<()> {
13125
13174
  for opt in &cf.set_options {
@@ -17585,7 +17634,13 @@ impl Generator {
17585
17634
 
17586
17635
  fn generate_function(&mut self, func: &Function) -> Result<()> {
17587
17636
  // Normalize function name based on dialect settings
17588
- let normalized_name = self.normalize_func_name(&func.name);
17637
+ let normalized_name = if matches!(self.config.dialect, Some(DialectType::Snowflake))
17638
+ && func.name.to_ascii_uppercase().starts_with("IDENTIFIER(")
17639
+ {
17640
+ Cow::Borrowed(func.name.as_str())
17641
+ } else {
17642
+ self.normalize_func_name(&func.name)
17643
+ };
17589
17644
 
17590
17645
  // DuckDB: ARRAY_CONSTRUCT_COMPACT(a, b, c) -> LIST_FILTER([a, b, c], _u -> NOT _u IS NULL)
17591
17646
  if matches!(self.config.dialect, Some(DialectType::DuckDB))
@@ -17924,7 +17979,7 @@ impl Generator {
17924
17979
  {
17925
17980
  self.write_keyword("DATEPART");
17926
17981
  self.write("(");
17927
- self.generate_expression(&func.args[0])?;
17982
+ self.write_tsql_date_part(&func.args[0])?;
17928
17983
  self.write(", ");
17929
17984
  self.generate_expression(&func.args[1])?;
17930
17985
  self.write(")");
@@ -18888,6 +18943,22 @@ impl Generator {
18888
18943
  }
18889
18944
  }
18890
18945
 
18946
+ fn write_tsql_date_part(&mut self, expr: &Expression) -> Result<()> {
18947
+ if let Some(part) = self.extract_date_part_string(expr) {
18948
+ let upper = part.to_ascii_uppercase();
18949
+ let unmapped = match upper.as_str() {
18950
+ "DAYOFWEEK" => "WEEKDAY",
18951
+ "WEEKISO" => "ISO_WEEK",
18952
+ "TIMEZONE_MINUTE" => "TZOFFSET",
18953
+ _ => part.as_str(),
18954
+ };
18955
+ self.write_keyword(unmapped);
18956
+ } else {
18957
+ self.generate_expression(expr)?;
18958
+ }
18959
+ Ok(())
18960
+ }
18961
+
18891
18962
  /// Extract date part string from expression (handles string literals and identifiers)
18892
18963
  fn extract_date_part_string(&self, expr: &Expression) -> Option<String> {
18893
18964
  match expr {
@@ -22591,6 +22662,36 @@ impl Generator {
22591
22662
  }
22592
22663
  }
22593
22664
 
22665
+ fn missing_closing_parens_outside_quotes(sql: &str) -> usize {
22666
+ let mut depth = 0usize;
22667
+ let mut quote: Option<char> = None;
22668
+ let mut chars = sql.chars().peekable();
22669
+
22670
+ while let Some(ch) = chars.next() {
22671
+ if let Some(quote_char) = quote {
22672
+ if ch == '\\' {
22673
+ chars.next();
22674
+ } else if ch == quote_char {
22675
+ if quote_char == '\'' && chars.peek() == Some(&'\'') {
22676
+ chars.next();
22677
+ } else {
22678
+ quote = None;
22679
+ }
22680
+ }
22681
+ continue;
22682
+ }
22683
+
22684
+ match ch {
22685
+ '\'' | '"' | '`' => quote = Some(ch),
22686
+ '(' => depth += 1,
22687
+ ')' => depth = depth.saturating_sub(1),
22688
+ _ => {}
22689
+ }
22690
+ }
22691
+
22692
+ depth
22693
+ }
22694
+
22594
22695
  /// Generate LIKE/ILIKE operation with optional ESCAPE clause
22595
22696
  fn generate_like_op(&mut self, op: &LikeOp, operator: &str) -> Result<()> {
22596
22697
  self.generate_like_op_inner(op, operator, false)
@@ -22615,6 +22716,51 @@ impl Generator {
22615
22716
  return self.generate_like_op_inner(op, operator, false);
22616
22717
  }
22617
22718
 
22719
+ if matches!(self.config.dialect, Some(DialectType::ClickHouse)) {
22720
+ if let Expression::Star(star) = &op.left {
22721
+ if star
22722
+ .except
22723
+ .as_ref()
22724
+ .is_some_and(|except| !except.is_empty())
22725
+ {
22726
+ if let Some(table) = &star.table {
22727
+ self.generate_identifier(table)?;
22728
+ self.write(".");
22729
+ }
22730
+ self.write("*");
22731
+ self.write_space();
22732
+ self.write_keyword(operator);
22733
+ if let Some(quantifier) = &op.quantifier {
22734
+ self.write_space();
22735
+ self.write_keyword(quantifier);
22736
+ self.write_space();
22737
+ } else {
22738
+ self.write_space();
22739
+ }
22740
+ self.generate_expression(&op.right)?;
22741
+ if let Some(escape) = &op.escape {
22742
+ self.write_space();
22743
+ self.write_keyword("ESCAPE");
22744
+ self.write_space();
22745
+ self.generate_expression(escape)?;
22746
+ }
22747
+ if let Some(except) = &star.except {
22748
+ self.write_space();
22749
+ self.write_keyword("EXCEPT");
22750
+ self.write(" (");
22751
+ for (i, col) in except.iter().enumerate() {
22752
+ if i > 0 {
22753
+ self.write(", ");
22754
+ }
22755
+ self.generate_identifier(col)?;
22756
+ }
22757
+ self.write(")");
22758
+ }
22759
+ return Ok(());
22760
+ }
22761
+ }
22762
+ }
22763
+
22618
22764
  self.generate_expression(&op.left)?;
22619
22765
  self.write_space();
22620
22766
  if negated {