polyglot-sql 0.5.12__tar.gz → 0.5.14__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 (186) hide show
  1. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/Cargo.lock +5 -5
  2. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/Cargo.toml +1 -1
  3. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/PKG-INFO +1 -1
  4. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/Cargo.toml +1 -1
  5. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/dialects/clickhouse.rs +5 -0
  6. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/dialects/mod.rs +242 -27
  7. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/dialects/postgres.rs +2 -2
  8. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/dialects/tsql.rs +272 -31
  9. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/generator.rs +21 -5
  10. polyglot_sql-0.5.14/crates/polyglot-sql/src/guard.rs +401 -0
  11. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/lib.rs +11 -0
  12. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/lineage.rs +13 -1
  13. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/parser.rs +110 -0
  14. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/resolver.rs +12 -1
  15. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/traversal.rs +29 -0
  16. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/tests/deep_nesting_regression.rs +67 -0
  17. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/tests/fabric_regression.rs +177 -1
  18. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/tests/issue227_strict_unsupported.rs +13 -0
  19. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/tests/tsql_regression.rs +181 -0
  20. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/README.md +0 -0
  21. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/README.md +0 -0
  22. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/benches/in_list.rs +0 -0
  23. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/benches/parsing.rs +0 -0
  24. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/benches/rust_parsing.rs +0 -0
  25. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/benches/transpile.rs +0 -0
  26. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/examples/basic_usage.rs +0 -0
  27. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/examples/bench_json.rs +0 -0
  28. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/ast_json.rs +0 -0
  29. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/ast_transforms.rs +0 -0
  30. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/builder.rs +0 -0
  31. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/dialects/athena.rs +0 -0
  32. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/dialects/bigquery.rs +0 -0
  33. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/dialects/cockroachdb.rs +0 -0
  34. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/dialects/databricks.rs +0 -0
  35. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/dialects/datafusion.rs +0 -0
  36. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/dialects/doris.rs +0 -0
  37. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/dialects/dremio.rs +0 -0
  38. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/dialects/drill.rs +0 -0
  39. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/dialects/druid.rs +0 -0
  40. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/dialects/duckdb.rs +0 -0
  41. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/dialects/dune.rs +0 -0
  42. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/dialects/exasol.rs +0 -0
  43. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/dialects/fabric.rs +0 -0
  44. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/dialects/generic.rs +0 -0
  45. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/dialects/hive.rs +0 -0
  46. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/dialects/materialize.rs +0 -0
  47. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/dialects/mysql.rs +0 -0
  48. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/dialects/oracle.rs +0 -0
  49. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/dialects/presto.rs +0 -0
  50. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/dialects/redshift.rs +0 -0
  51. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/dialects/risingwave.rs +0 -0
  52. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/dialects/singlestore.rs +0 -0
  53. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/dialects/snowflake.rs +0 -0
  54. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/dialects/solr.rs +0 -0
  55. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/dialects/spark.rs +0 -0
  56. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/dialects/sqlite.rs +0 -0
  57. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/dialects/starrocks.rs +0 -0
  58. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/dialects/tableau.rs +0 -0
  59. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/dialects/teradata.rs +0 -0
  60. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/dialects/tidb.rs +0 -0
  61. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/dialects/trino.rs +0 -0
  62. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/diff.rs +0 -0
  63. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/error.rs +0 -0
  64. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/expressions.rs +0 -0
  65. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/function_catalog.rs +0 -0
  66. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/function_registry.rs +0 -0
  67. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/helper.rs +0 -0
  68. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/openlineage.rs +0 -0
  69. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/optimizer/annotate_types.rs +0 -0
  70. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/optimizer/canonicalize.rs +0 -0
  71. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/optimizer/eliminate_ctes.rs +0 -0
  72. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/optimizer/eliminate_joins.rs +0 -0
  73. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/optimizer/isolate_table_selects.rs +0 -0
  74. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/optimizer/mod.rs +0 -0
  75. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/optimizer/normalize.rs +0 -0
  76. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/optimizer/normalize_identifiers.rs +0 -0
  77. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/optimizer/optimize_joins.rs +0 -0
  78. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/optimizer/optimizer.rs +0 -0
  79. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/optimizer/pushdown_predicates.rs +0 -0
  80. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/optimizer/pushdown_projections.rs +0 -0
  81. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/optimizer/qualify_columns.rs +0 -0
  82. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/optimizer/qualify_tables.rs +0 -0
  83. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/optimizer/simplify.rs +0 -0
  84. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/optimizer/subquery.rs +0 -0
  85. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/planner.rs +0 -0
  86. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/query_analysis.rs +0 -0
  87. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/schema.rs +0 -0
  88. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/scope.rs +0 -0
  89. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/time.rs +0 -0
  90. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/tokens.rs +0 -0
  91. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/transforms.rs +0 -0
  92. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/trie.rs +0 -0
  93. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/validation/tests.rs +0 -0
  94. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/src/validation.rs +0 -0
  95. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/tests/analyze_failures.rs +0 -0
  96. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/tests/clickhouse_regression.rs +0 -0
  97. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/tests/common/known_failures.rs +0 -0
  98. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/tests/common/mod.rs +0 -0
  99. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/tests/common/test_data.rs +0 -0
  100. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/tests/common/test_runner.rs +0 -0
  101. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/tests/create_view_security_comment_regression.rs +0 -0
  102. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/tests/custom_clickhouse_coverage.rs +0 -0
  103. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/tests/custom_clickhouse_parser.rs +0 -0
  104. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/tests/custom_dialect.rs +0 -0
  105. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/tests/custom_dialect_tests.rs +0 -0
  106. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/tests/custom_fixtures/datafusion/ddl.json +0 -0
  107. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/tests/custom_fixtures/datafusion/dml.json +0 -0
  108. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/tests/custom_fixtures/datafusion/functions.json +0 -0
  109. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/tests/custom_fixtures/datafusion/identity.json +0 -0
  110. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/tests/custom_fixtures/datafusion/operators.json +0 -0
  111. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/tests/custom_fixtures/datafusion/select.json +0 -0
  112. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/tests/custom_fixtures/datafusion/transpilation.json +0 -0
  113. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/tests/custom_fixtures/datafusion/types.json +0 -0
  114. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/tests/data_type_api.rs +0 -0
  115. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/tests/dialect_matrix.rs +0 -0
  116. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/tests/error_handling.rs +0 -0
  117. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/tests/fabric_tpch_regression.rs +0 -0
  118. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/tests/identity_roundtrip.rs +0 -0
  119. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/tests/issue201_regression_test.rs +0 -0
  120. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/tests/issue210_regression_test.rs +0 -0
  121. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/tests/issue226_regression_test.rs +0 -0
  122. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/tests/postgres_sqlite_regression.rs +0 -0
  123. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/tests/query_analysis.rs +0 -0
  124. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/tests/query_analysis_regression.rs +0 -0
  125. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/tests/snowflake_regression_test.rs +0 -0
  126. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/tests/sqlglot_compat.rs +0 -0
  127. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/tests/sqlglot_dialect_identity.rs +0 -0
  128. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/tests/sqlglot_identity.rs +0 -0
  129. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/tests/sqlglot_identity_detailed.rs +0 -0
  130. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/tests/sqlglot_parser.rs +0 -0
  131. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/tests/sqlglot_pretty.rs +0 -0
  132. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/tests/sqlglot_transpilation.rs +0 -0
  133. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/tests/sqlglot_transpile.rs +0 -0
  134. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/tests/tpch_transpile_stack.rs +0 -0
  135. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql/tests/transform_regression.rs +0 -0
  136. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql-function-catalogs/Cargo.toml +0 -0
  137. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql-function-catalogs/README.md +0 -0
  138. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql-function-catalogs/src/clickhouse.rs +0 -0
  139. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql-function-catalogs/src/duckdb.rs +0 -0
  140. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql-function-catalogs/src/lib.rs +0 -0
  141. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql-function-catalogs/tools/clickhouse/extract_functions.py +0 -0
  142. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql-function-catalogs/tools/duckdb/extract_functions.py +0 -0
  143. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql-python/Cargo.toml +0 -0
  144. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql-python/README.md +0 -0
  145. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql-python/docs/api.md +0 -0
  146. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql-python/docs/index.md +0 -0
  147. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql-python/mkdocs.yml +0 -0
  148. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql-python/src/annotate_types.rs +0 -0
  149. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql-python/src/dialects.rs +0 -0
  150. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql-python/src/diff.rs +0 -0
  151. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql-python/src/errors.rs +0 -0
  152. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql-python/src/expr.rs +0 -0
  153. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql-python/src/expr_types.rs +0 -0
  154. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql-python/src/format.rs +0 -0
  155. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql-python/src/generate.rs +0 -0
  156. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql-python/src/helpers.rs +0 -0
  157. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql-python/src/lib.rs +0 -0
  158. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql-python/src/lineage.rs +0 -0
  159. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql-python/src/openlineage.rs +0 -0
  160. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql-python/src/optimize.rs +0 -0
  161. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql-python/src/parse.rs +0 -0
  162. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql-python/src/query_analysis.rs +0 -0
  163. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql-python/src/tokenize.rs +0 -0
  164. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql-python/src/transforms.rs +0 -0
  165. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql-python/src/transpile.rs +0 -0
  166. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql-python/src/types.rs +0 -0
  167. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql-python/src/validate.rs +0 -0
  168. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql-python/tests/conftest.py +0 -0
  169. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql-python/tests/test_compat.py +0 -0
  170. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql-python/tests/test_dialects.py +0 -0
  171. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql-python/tests/test_diff.py +0 -0
  172. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql-python/tests/test_expression.py +0 -0
  173. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql-python/tests/test_format.py +0 -0
  174. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql-python/tests/test_generate.py +0 -0
  175. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql-python/tests/test_lineage.py +0 -0
  176. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql-python/tests/test_optimize.py +0 -0
  177. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql-python/tests/test_parse.py +0 -0
  178. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql-python/tests/test_query_analysis.py +0 -0
  179. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql-python/tests/test_transforms.py +0 -0
  180. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql-python/tests/test_transpile.py +0 -0
  181. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql-python/tests/test_validate.py +0 -0
  182. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/crates/polyglot-sql-python/uv.lock +0 -0
  183. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/pyproject.toml +0 -0
  184. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/python/polyglot_sql/__init__.py +0 -0
  185. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/python/polyglot_sql/__init__.pyi +0 -0
  186. {polyglot_sql-0.5.12 → polyglot_sql-0.5.14}/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.12"
608
+ version = "0.5.14"
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.12"
624
+ version = "0.5.14"
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.12"
634
+ version = "0.5.14"
635
635
 
636
636
  [[package]]
637
637
  name = "polyglot-sql-python"
638
- version = "0.5.12"
638
+ version = "0.5.14"
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.12"
649
+ version = "0.5.14"
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.12"
9
+ version = "0.5.14"
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.12
3
+ Version: 0.5.14
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.12", optional = true, default-features = false }
109
+ polyglot-sql-function-catalogs = { path = "../polyglot-sql-function-catalogs", version = "0.5.14", optional = true, default-features = false }
110
110
 
111
111
  [dev-dependencies]
112
112
  pretty_assertions = "1.4"
@@ -56,10 +56,15 @@ impl DialectImpl for ClickHouseDialect {
56
56
 
57
57
  fn generator_config(&self) -> GeneratorConfig {
58
58
  use crate::generator::{IdentifierQuoteStyle, NormalizeFunctions};
59
+ let mut complexity_guard = crate::guard::ComplexityGuardOptions::default();
60
+ complexity_guard.max_ast_depth = Some(4_096);
61
+ complexity_guard.max_function_call_depth = Some(512);
62
+
59
63
  GeneratorConfig {
60
64
  identifier_quote: '"',
61
65
  identifier_quote_style: IdentifierQuoteStyle::DOUBLE_QUOTE,
62
66
  dialect: Some(DialectType::ClickHouse),
67
+ complexity_guard,
63
68
  // ClickHouse uses uppercase keywords (matching Python SQLGlot behavior)
64
69
  uppercase_keywords: true,
65
70
  // ClickHouse function names are case-sensitive and typically camelCase
@@ -159,7 +159,7 @@ pub use tsql::TSQLDialect;
159
159
 
160
160
  use crate::error::Result;
161
161
  #[cfg(feature = "transpile")]
162
- use crate::expressions::{ColumnConstraint, Function, Identifier, Literal};
162
+ use crate::expressions::{Cast, ColumnConstraint, Function, Identifier, Literal};
163
163
  use crate::expressions::{DataType, Expression};
164
164
  #[cfg(any(
165
165
  feature = "transpile",
@@ -172,6 +172,9 @@ use crate::expressions::{From, FunctionBody, Join, Null, OrderBy, OutputClause,
172
172
  use crate::generator::UnsupportedLevel;
173
173
  #[cfg(feature = "generate")]
174
174
  use crate::generator::{Generator, GeneratorConfig};
175
+ #[cfg(feature = "transpile")]
176
+ use crate::guard::enforce_generate_ast;
177
+ use crate::guard::{enforce_input, ComplexityGuardOptions};
175
178
  use crate::parser::Parser;
176
179
  #[cfg(feature = "transpile")]
177
180
  use crate::tokens::TokenType;
@@ -3168,15 +3171,26 @@ where
3168
3171
  // JoinedTable: (tbl1 JOIN tbl2 ON ...) - recurse into left and join tables
3169
3172
  Expression::JoinedTable(mut jt) => {
3170
3173
  jt.left = transform_recursive(jt.left, transform_fn)?;
3171
- for join in &mut jt.joins {
3172
- join.this = transform_recursive(
3173
- std::mem::replace(&mut join.this, Expression::Null(crate::expressions::Null)),
3174
- transform_fn,
3175
- )?;
3176
- if let Some(on) = join.on.take() {
3177
- join.on = Some(transform_recursive(on, transform_fn)?);
3178
- }
3179
- }
3174
+ jt.joins = jt
3175
+ .joins
3176
+ .into_iter()
3177
+ .map(|mut join| {
3178
+ join.this = transform_recursive(join.this, transform_fn)?;
3179
+ if let Some(on) = join.on.take() {
3180
+ join.on = Some(transform_recursive(on, transform_fn)?);
3181
+ }
3182
+ match transform_fn(Expression::Join(Box::new(join)))? {
3183
+ Expression::Join(j) => Ok(*j),
3184
+ _ => Err(crate::error::Error::parse(
3185
+ "Join transformation returned non-join expression",
3186
+ 0,
3187
+ 0,
3188
+ 0,
3189
+ 0,
3190
+ )),
3191
+ }
3192
+ })
3193
+ .collect::<Result<Vec<_>>>()?;
3180
3194
  jt.lateral_views = jt
3181
3195
  .lateral_views
3182
3196
  .into_iter()
@@ -3747,6 +3761,8 @@ pub struct TranspileOptions {
3747
3761
  pub unsupported_level: UnsupportedLevel,
3748
3762
  /// Maximum number of unsupported diagnostics to include in raised errors.
3749
3763
  pub max_unsupported: usize,
3764
+ /// Complexity guard limits used while parsing, transforming, and generating.
3765
+ pub complexity_guard: ComplexityGuardOptions,
3750
3766
  }
3751
3767
 
3752
3768
  #[cfg(feature = "transpile")]
@@ -3756,6 +3772,7 @@ impl Default for TranspileOptions {
3756
3772
  pretty: false,
3757
3773
  unsupported_level: UnsupportedLevel::Warn,
3758
3774
  max_unsupported: 3,
3775
+ complexity_guard: ComplexityGuardOptions::default(),
3759
3776
  }
3760
3777
  }
3761
3778
  }
@@ -3789,6 +3806,12 @@ impl TranspileOptions {
3789
3806
  self.max_unsupported = max;
3790
3807
  self
3791
3808
  }
3809
+
3810
+ /// Set complexity guard limits for parse/transpile/generate recursion-heavy paths.
3811
+ pub fn with_complexity_guard(mut self, guard: ComplexityGuardOptions) -> Self {
3812
+ self.complexity_guard = guard;
3813
+ self
3814
+ }
3792
3815
  }
3793
3816
 
3794
3817
  /// A value that can be used as the target dialect in [`Dialect::transpile`] /
@@ -3927,23 +3950,67 @@ impl Dialect {
3927
3950
  /// produces a separate element in the returned vector. Tokenization uses
3928
3951
  /// this dialect's configured tokenizer, and parsing uses the dialect-aware parser.
3929
3952
  pub fn parse(&self, sql: &str) -> Result<Vec<Expression>> {
3953
+ self.parse_with_guard(sql, self.default_complexity_guard())
3954
+ }
3955
+
3956
+ fn parse_with_guard(
3957
+ &self,
3958
+ sql: &str,
3959
+ complexity_guard: ComplexityGuardOptions,
3960
+ ) -> Result<Vec<Expression>> {
3961
+ enforce_input(sql, &complexity_guard)?;
3930
3962
  let tokens = self.tokenizer.tokenize(sql)?;
3931
3963
  let config = crate::parser::ParserConfig {
3932
3964
  dialect: Some(self.dialect_type),
3965
+ complexity_guard,
3933
3966
  ..Default::default()
3934
3967
  };
3935
3968
  let mut parser = Parser::with_source(tokens, config, sql.to_string());
3936
3969
  parser.parse()
3937
3970
  }
3938
3971
 
3972
+ fn default_complexity_guard(&self) -> ComplexityGuardOptions {
3973
+ let mut guard = ComplexityGuardOptions::default();
3974
+ if matches!(self.dialect_type, DialectType::ClickHouse) {
3975
+ guard.max_ast_depth = Some(4_096);
3976
+ guard.max_function_call_depth = Some(512);
3977
+ }
3978
+ guard
3979
+ }
3980
+
3981
+ #[cfg(feature = "transpile")]
3982
+ fn default_transpile_complexity_guard(
3983
+ &self,
3984
+ target_dialect: &Dialect,
3985
+ guard: ComplexityGuardOptions,
3986
+ ) -> ComplexityGuardOptions {
3987
+ if guard != ComplexityGuardOptions::default() {
3988
+ return guard;
3989
+ }
3990
+
3991
+ if matches!(self.dialect_type, DialectType::ClickHouse)
3992
+ || matches!(target_dialect.dialect_type, DialectType::ClickHouse)
3993
+ {
3994
+ let mut guard = guard;
3995
+ guard.max_ast_depth = Some(4_096);
3996
+ guard.max_function_call_depth = Some(512);
3997
+ guard
3998
+ } else {
3999
+ guard
4000
+ }
4001
+ }
4002
+
3939
4003
  /// Parse a standalone SQL data type using this dialect's tokenizer and parser.
3940
4004
  ///
3941
4005
  /// This accepts type strings such as `DECIMAL(10, 2)`, `INT[]`, or
3942
4006
  /// `STRUCT(a INT, b VARCHAR)` without requiring a surrounding statement.
3943
4007
  pub fn parse_data_type(&self, sql: &str) -> Result<DataType> {
4008
+ let complexity_guard = self.default_complexity_guard();
4009
+ enforce_input(sql, &complexity_guard)?;
3944
4010
  let tokens = self.tokenizer.tokenize(sql)?;
3945
4011
  let config = crate::parser::ParserConfig {
3946
4012
  dialect: Some(self.dialect_type),
4013
+ complexity_guard,
3947
4014
  ..Default::default()
3948
4015
  };
3949
4016
  let mut parser = Parser::with_source(tokens, config, sql.to_string());
@@ -4028,6 +4095,7 @@ impl Dialect {
4028
4095
  config.pretty = opts.pretty;
4029
4096
  config.unsupported_level = opts.unsupported_level;
4030
4097
  config.max_unsupported = opts.max_unsupported.max(1);
4098
+ config.complexity_guard = opts.complexity_guard;
4031
4099
  let mut generator = Generator::with_config(config);
4032
4100
  generator.generate(expr)
4033
4101
  }
@@ -4076,6 +4144,16 @@ impl Dialect {
4076
4144
  /// and for identity transforms (normalizing SQL within the same dialect).
4077
4145
  #[cfg(feature = "transpile")]
4078
4146
  pub fn transform(&self, expr: Expression) -> Result<Expression> {
4147
+ self.transform_with_guard(expr, self.default_complexity_guard())
4148
+ }
4149
+
4150
+ #[cfg(feature = "transpile")]
4151
+ fn transform_with_guard(
4152
+ &self,
4153
+ expr: Expression,
4154
+ complexity_guard: ComplexityGuardOptions,
4155
+ ) -> Result<Expression> {
4156
+ enforce_generate_ast(&expr, &complexity_guard)?;
4079
4157
  // Apply preprocessing transforms based on dialect
4080
4158
  let preprocessed = self.preprocess(expr)?;
4081
4159
  // Then apply recursive transformation
@@ -4318,13 +4396,17 @@ impl Dialect {
4318
4396
  target_dialect: &Dialect,
4319
4397
  opts: &TranspileOptions,
4320
4398
  ) -> Result<Vec<String>> {
4399
+ let mut effective_opts = opts.clone();
4400
+ effective_opts.complexity_guard =
4401
+ self.default_transpile_complexity_guard(target_dialect, opts.complexity_guard);
4402
+ let opts = &effective_opts;
4321
4403
  let target = target_dialect.dialect_type;
4322
4404
  if matches!(self.dialect_type, DialectType::PostgreSQL)
4323
4405
  && matches!(target, DialectType::SQLite)
4324
4406
  {
4325
4407
  self.reject_pgvector_distance_operators_for_sqlite(sql)?;
4326
4408
  }
4327
- let expressions = self.parse(sql)?;
4409
+ let expressions = self.parse_with_guard(sql, opts.complexity_guard)?;
4328
4410
  let generic_identity =
4329
4411
  self.dialect_type == DialectType::Generic && target == DialectType::Generic;
4330
4412
 
@@ -4362,7 +4444,7 @@ impl Dialect {
4362
4444
  // This handles cases like Snowflake's SQUARE -> POWER, DIV0 -> CASE, etc.
4363
4445
  let normalized =
4364
4446
  if self.dialect_type != target && self.dialect_type != DialectType::Generic {
4365
- self.transform(expr)?
4447
+ self.transform_with_guard(expr, opts.complexity_guard)?
4366
4448
  } else {
4367
4449
  expr
4368
4450
  };
@@ -4634,6 +4716,17 @@ impl Dialect {
4634
4716
  let normalized =
4635
4717
  Self::cross_dialect_normalize(normalized, self.dialect_type, target)?;
4636
4718
 
4719
+ let normalized =
4720
+ if matches!(
4721
+ self.dialect_type,
4722
+ DialectType::PostgreSQL | DialectType::CockroachDB
4723
+ ) && !matches!(target, DialectType::PostgreSQL | DialectType::CockroachDB)
4724
+ {
4725
+ Self::normalize_postgres_type_function_casts(normalized)?
4726
+ } else {
4727
+ normalized
4728
+ };
4729
+
4637
4730
  let normalized = if matches!(self.dialect_type, DialectType::SQLite)
4638
4731
  && !matches!(target, DialectType::SQLite)
4639
4732
  {
@@ -4799,7 +4892,8 @@ impl Dialect {
4799
4892
  normalized
4800
4893
  };
4801
4894
 
4802
- let transformed = target_dialect.transform(normalized)?;
4895
+ let transformed =
4896
+ target_dialect.transform_with_guard(normalized, opts.complexity_guard)?;
4803
4897
 
4804
4898
  // T-SQL and Fabric do not support aggregate FILTER clauses. Rewrite any
4805
4899
  // remaining filters after target transforms so special aggregate rewrites
@@ -4888,6 +4982,15 @@ impl Dialect {
4888
4982
  );
4889
4983
  }
4890
4984
 
4985
+ if matches!(target, DialectType::TSQL | DialectType::Fabric)
4986
+ && Self::node_is_non_subquery_any(node)
4987
+ {
4988
+ Self::push_unsupported_diagnostic(
4989
+ &mut diagnostics,
4990
+ "ANY over non-subquery expressions",
4991
+ );
4992
+ }
4993
+
4891
4994
  if matches!(source, DialectType::PostgreSQL | DialectType::CockroachDB)
4892
4995
  && !matches!(target, DialectType::PostgreSQL | DialectType::CockroachDB)
4893
4996
  {
@@ -4900,6 +5003,14 @@ impl Dialect {
4900
5003
  if Self::node_is_function_named(node, "TO_TSVECTOR") {
4901
5004
  Self::push_unsupported_diagnostic(&mut diagnostics, "PostgreSQL TO_TSVECTOR");
4902
5005
  }
5006
+ if matches!(target, DialectType::TSQL | DialectType::Fabric)
5007
+ && Self::node_is_postgres_type_function_cast(node)
5008
+ {
5009
+ Self::push_unsupported_diagnostic(
5010
+ &mut diagnostics,
5011
+ "PostgreSQL type-name function casts",
5012
+ );
5013
+ }
4903
5014
  }
4904
5015
 
4905
5016
  if opts.unsupported_level == UnsupportedLevel::Immediate && !diagnostics.is_empty() {
@@ -4953,28 +5064,41 @@ impl Dialect {
4953
5064
  }
4954
5065
 
4955
5066
  fn node_has_lateral(expr: &Expression) -> bool {
5067
+ fn join_has_lateral(join: &Join) -> bool {
5068
+ matches!(
5069
+ join.kind,
5070
+ crate::expressions::JoinKind::Lateral | crate::expressions::JoinKind::LeftLateral
5071
+ ) || Dialect::node_has_lateral(&join.this)
5072
+ || join.on.as_ref().is_some_and(Dialect::node_has_lateral)
5073
+ || join
5074
+ .match_condition
5075
+ .as_ref()
5076
+ .is_some_and(Dialect::node_has_lateral)
5077
+ || join.pivots.iter().any(Dialect::node_has_lateral)
5078
+ }
5079
+
4956
5080
  fn joins_have_lateral(joins: &[Join]) -> bool {
4957
- joins.iter().any(|join| {
4958
- matches!(
4959
- join.kind,
4960
- crate::expressions::JoinKind::Lateral
4961
- | crate::expressions::JoinKind::LeftLateral
4962
- )
4963
- })
5081
+ joins.iter().any(join_has_lateral)
4964
5082
  }
4965
5083
 
4966
5084
  match expr {
4967
- Expression::Subquery(subquery) => subquery.lateral,
5085
+ Expression::Subquery(subquery) => {
5086
+ subquery.lateral || Dialect::node_has_lateral(&subquery.this)
5087
+ }
4968
5088
  Expression::Lateral(_) | Expression::LateralView(_) => true,
4969
- Expression::Join(join) => matches!(
4970
- join.kind,
4971
- crate::expressions::JoinKind::Lateral | crate::expressions::JoinKind::LeftLateral
4972
- ),
5089
+ Expression::Join(join) => join_has_lateral(join),
4973
5090
  Expression::Select(select) => {
4974
- !select.lateral_views.is_empty() || joins_have_lateral(&select.joins)
5091
+ !select.lateral_views.is_empty()
5092
+ || joins_have_lateral(&select.joins)
5093
+ || select
5094
+ .from
5095
+ .as_ref()
5096
+ .is_some_and(|from| from.expressions.iter().any(Dialect::node_has_lateral))
4975
5097
  }
4976
5098
  Expression::JoinedTable(joined) => {
4977
- !joined.lateral_views.is_empty() || joins_have_lateral(&joined.joins)
5099
+ !joined.lateral_views.is_empty()
5100
+ || Dialect::node_has_lateral(&joined.left)
5101
+ || joins_have_lateral(&joined.joins)
4978
5102
  }
4979
5103
  Expression::Update(update) => {
4980
5104
  joins_have_lateral(&update.table_joins) || joins_have_lateral(&update.from_joins)
@@ -5036,6 +5160,21 @@ impl Dialect {
5036
5160
  || Self::node_is_function_named(expr, "REGEXP_ILIKE")
5037
5161
  }
5038
5162
 
5163
+ fn node_is_non_subquery_any(expr: &Expression) -> bool {
5164
+ matches!(
5165
+ expr,
5166
+ Expression::Any(q) if !Self::quantified_rhs_is_subquery(&q.subquery)
5167
+ )
5168
+ }
5169
+
5170
+ fn quantified_rhs_is_subquery(expr: &Expression) -> bool {
5171
+ match expr {
5172
+ Expression::Select(_) | Expression::Subquery(_) => true,
5173
+ Expression::Paren(paren) => Self::quantified_rhs_is_subquery(&paren.this),
5174
+ _ => false,
5175
+ }
5176
+ }
5177
+
5039
5178
  fn node_is_function_named(expr: &Expression, name: &str) -> bool {
5040
5179
  match expr {
5041
5180
  Expression::Function(function) => function.name.eq_ignore_ascii_case(name),
@@ -5044,6 +5183,82 @@ impl Dialect {
5044
5183
  }
5045
5184
  }
5046
5185
 
5186
+ fn normalize_postgres_type_function_casts(expr: Expression) -> Result<Expression> {
5187
+ transform_recursive(expr, &|e| match e {
5188
+ Expression::Function(function) => {
5189
+ let mut function = *function;
5190
+ if function.args.len() == 1
5191
+ && !function.distinct
5192
+ && !function.quoted
5193
+ && !function.use_bracket_syntax
5194
+ && !function.name.contains('.')
5195
+ {
5196
+ if let Some(to) = Self::postgres_type_function_data_type(&function.name) {
5197
+ let this = function.args.remove(0);
5198
+ return Ok(Expression::Cast(Box::new(Cast {
5199
+ this,
5200
+ to,
5201
+ trailing_comments: function.trailing_comments,
5202
+ double_colon_syntax: false,
5203
+ format: None,
5204
+ default: None,
5205
+ inferred_type: function.inferred_type,
5206
+ })));
5207
+ }
5208
+ }
5209
+ Ok(Expression::Function(Box::new(function)))
5210
+ }
5211
+ _ => Ok(e),
5212
+ })
5213
+ }
5214
+
5215
+ fn node_is_postgres_type_function_cast(expr: &Expression) -> bool {
5216
+ matches!(
5217
+ expr,
5218
+ Expression::Function(function)
5219
+ if !function.quoted
5220
+ && !function.use_bracket_syntax
5221
+ && !function.name.contains('.')
5222
+ && Self::postgres_type_function_data_type(&function.name).is_some()
5223
+ )
5224
+ }
5225
+
5226
+ fn postgres_type_function_data_type(name: &str) -> Option<DataType> {
5227
+ match name.to_ascii_uppercase().as_str() {
5228
+ "NUMERIC" | "DECIMAL" | "DEC" => Some(DataType::Decimal {
5229
+ precision: None,
5230
+ scale: None,
5231
+ }),
5232
+ "INT2" | "SMALLINT" => Some(DataType::SmallInt { length: None }),
5233
+ "INT4" | "INT" => Some(DataType::Int {
5234
+ length: None,
5235
+ integer_spelling: false,
5236
+ }),
5237
+ "INTEGER" => Some(DataType::Int {
5238
+ length: None,
5239
+ integer_spelling: true,
5240
+ }),
5241
+ "INT8" | "BIGINT" => Some(DataType::BigInt { length: None }),
5242
+ "FLOAT4" | "REAL" => Some(DataType::Float {
5243
+ precision: None,
5244
+ scale: None,
5245
+ real_spelling: true,
5246
+ }),
5247
+ "FLOAT8" => Some(DataType::Double {
5248
+ precision: None,
5249
+ scale: None,
5250
+ }),
5251
+ "BOOL" | "BOOLEAN" => Some(DataType::Boolean),
5252
+ "TEXT" => Some(DataType::Text),
5253
+ "VARCHAR" => Some(DataType::VarChar {
5254
+ length: None,
5255
+ parenthesized_length: false,
5256
+ }),
5257
+ "UUID" => Some(DataType::Uuid),
5258
+ _ => None,
5259
+ }
5260
+ }
5261
+
5047
5262
  fn rewrite_boolean_values_for_tsql(expr: Expression) -> Result<Expression> {
5048
5263
  match expr {
5049
5264
  Expression::Select(select) => Self::rewrite_boolean_values_in_tsql_select(select),
@@ -1201,8 +1201,8 @@ impl PostgresDialect {
1201
1201
  vec![],
1202
1202
  )))),
1203
1203
 
1204
- // UUID -> GEN_RANDOM_UUID in PostgreSQL
1205
- "UUID" => Ok(Expression::Function(Box::new(Function::new(
1204
+ // UUID() -> GEN_RANDOM_UUID in PostgreSQL
1205
+ "UUID" if f.args.is_empty() => Ok(Expression::Function(Box::new(Function::new(
1206
1206
  "GEN_RANDOM_UUID".to_string(),
1207
1207
  vec![],
1208
1208
  )))),