polyglot-sql 0.5.11__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.
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/Cargo.lock +5 -5
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/Cargo.toml +1 -1
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/PKG-INFO +1 -1
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/Cargo.toml +1 -1
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/duckdb.rs +0 -13
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/mod.rs +141 -2
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/postgres.rs +0 -16
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/expressions.rs +5 -2
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/generator.rs +135 -5
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/parser.rs +367 -80
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/tokens.rs +9 -0
- polyglot_sql-0.5.12/crates/polyglot-sql/tests/create_view_security_comment_regression.rs +102 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/tsql_regression.rs +64 -2
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/README.md +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/README.md +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/benches/in_list.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/benches/parsing.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/benches/rust_parsing.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/benches/transpile.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/examples/basic_usage.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/examples/bench_json.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/ast_json.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/ast_transforms.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/builder.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/athena.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/bigquery.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/clickhouse.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/cockroachdb.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/databricks.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/datafusion.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/doris.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/dremio.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/drill.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/druid.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/dune.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/exasol.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/fabric.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/generic.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/hive.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/materialize.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/mysql.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/oracle.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/presto.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/redshift.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/risingwave.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/singlestore.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/snowflake.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/solr.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/spark.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/sqlite.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/starrocks.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/tableau.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/teradata.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/tidb.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/trino.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/dialects/tsql.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/diff.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/error.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/function_catalog.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/function_registry.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/helper.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/lib.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/lineage.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/openlineage.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/optimizer/annotate_types.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/optimizer/canonicalize.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/optimizer/eliminate_ctes.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/optimizer/eliminate_joins.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/optimizer/isolate_table_selects.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/optimizer/mod.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/optimizer/normalize.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/optimizer/normalize_identifiers.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/optimizer/optimize_joins.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/optimizer/optimizer.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/optimizer/pushdown_predicates.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/optimizer/pushdown_projections.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/optimizer/qualify_columns.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/optimizer/qualify_tables.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/optimizer/simplify.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/optimizer/subquery.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/planner.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/query_analysis.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/resolver.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/schema.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/scope.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/time.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/transforms.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/traversal.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/trie.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/validation/tests.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/src/validation.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/analyze_failures.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/clickhouse_regression.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/common/known_failures.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/common/mod.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/common/test_data.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/common/test_runner.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/custom_clickhouse_coverage.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/custom_clickhouse_parser.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/custom_dialect.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/custom_dialect_tests.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/custom_fixtures/datafusion/ddl.json +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/custom_fixtures/datafusion/dml.json +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/custom_fixtures/datafusion/functions.json +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/custom_fixtures/datafusion/identity.json +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/custom_fixtures/datafusion/operators.json +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/custom_fixtures/datafusion/select.json +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/custom_fixtures/datafusion/transpilation.json +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/custom_fixtures/datafusion/types.json +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/data_type_api.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/deep_nesting_regression.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/dialect_matrix.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/error_handling.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/fabric_regression.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/fabric_tpch_regression.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/identity_roundtrip.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/issue201_regression_test.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/issue210_regression_test.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/issue226_regression_test.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/issue227_strict_unsupported.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/postgres_sqlite_regression.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/query_analysis.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/query_analysis_regression.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/snowflake_regression_test.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/sqlglot_compat.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/sqlglot_dialect_identity.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/sqlglot_identity.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/sqlglot_identity_detailed.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/sqlglot_parser.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/sqlglot_pretty.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/sqlglot_transpilation.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/sqlglot_transpile.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/tpch_transpile_stack.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql/tests/transform_regression.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql-function-catalogs/Cargo.toml +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql-function-catalogs/README.md +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql-function-catalogs/src/clickhouse.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql-function-catalogs/src/duckdb.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql-function-catalogs/src/lib.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql-function-catalogs/tools/clickhouse/extract_functions.py +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql-function-catalogs/tools/duckdb/extract_functions.py +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/Cargo.toml +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/README.md +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/docs/api.md +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/docs/index.md +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/mkdocs.yml +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/src/annotate_types.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/src/dialects.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/src/diff.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/src/errors.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/src/expr.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/src/expr_types.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/src/format.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/src/generate.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/src/helpers.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/src/lib.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/src/lineage.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/src/openlineage.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/src/optimize.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/src/parse.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/src/query_analysis.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/src/tokenize.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/src/transforms.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/src/transpile.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/src/types.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/src/validate.rs +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/tests/conftest.py +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/tests/test_compat.py +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/tests/test_dialects.py +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/tests/test_diff.py +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/tests/test_expression.py +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/tests/test_format.py +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/tests/test_generate.py +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/tests/test_lineage.py +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/tests/test_optimize.py +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/tests/test_parse.py +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/tests/test_query_analysis.py +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/tests/test_transforms.py +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/tests/test_transpile.py +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/tests/test_validate.py +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/crates/polyglot-sql-python/uv.lock +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/pyproject.toml +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/python/polyglot_sql/__init__.py +0 -0
- {polyglot_sql-0.5.11 → polyglot_sql-0.5.12}/python/polyglot_sql/__init__.pyi +0 -0
- {polyglot_sql-0.5.11 → 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.
|
|
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.
|
|
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.
|
|
634
|
+
version = "0.5.12"
|
|
635
635
|
|
|
636
636
|
[[package]]
|
|
637
637
|
name = "polyglot-sql-python"
|
|
638
|
-
version = "0.5.
|
|
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.
|
|
649
|
+
version = "0.5.12"
|
|
650
650
|
dependencies = [
|
|
651
651
|
"console_error_panic_hook",
|
|
652
652
|
"js-sys",
|
|
@@ -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.
|
|
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
|
|
@@ -8929,7 +8929,7 @@ impl Dialect {
|
|
|
8929
8929
|
| "SAFE_ADD" | "SAFE_SUBTRACT" | "SAFE_MULTIPLY"
|
|
8930
8930
|
| "SAFE_CAST"
|
|
8931
8931
|
| "GENERATE_DATE_ARRAY"
|
|
8932
|
-
| "PARSE_DATE" | "PARSE_TIMESTAMP"
|
|
8932
|
+
| "PARSE_DATE" | "PARSE_DATETIME" | "PARSE_TIMESTAMP"
|
|
8933
8933
|
| "FORMAT_DATE" | "FORMAT_DATETIME" | "FORMAT_TIMESTAMP"
|
|
8934
8934
|
| "ARRAY_CONCAT"
|
|
8935
8935
|
| "JSON_QUERY" | "JSON_VALUE_ARRAY"
|
|
@@ -9058,7 +9058,8 @@ impl Dialect {
|
|
|
9058
9058
|
| "CONVERT" | "TRY_CONVERT"
|
|
9059
9059
|
| "STRFTIME" | "STRPTIME"
|
|
9060
9060
|
| "DATE_FORMAT" | "FORMAT_DATE"
|
|
9061
|
-
| "PARSE_TIMESTAMP" | "PARSE_DATE"
|
|
9061
|
+
| "PARSE_TIMESTAMP" | "PARSE_DATETIME" | "PARSE_DATE"
|
|
9062
|
+
| "FROM_ISO8601_TIMESTAMP" | "FROM_ISO8601_DATE"
|
|
9062
9063
|
| "FROM_BASE64" | "TO_BASE64"
|
|
9063
9064
|
| "GETDATE"
|
|
9064
9065
|
| "TO_HEX" | "FROM_HEX" | "UNHEX" | "HEX"
|
|
@@ -14587,6 +14588,108 @@ impl Dialect {
|
|
|
14587
14588
|
)))),
|
|
14588
14589
|
}
|
|
14589
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
|
+
}
|
|
14590
14693
|
// MAP(keys_array, vals_array) from Presto (2-arg form) -> target-specific
|
|
14591
14694
|
"MAP"
|
|
14592
14695
|
if f.args.len() == 2
|
|
@@ -14724,6 +14827,7 @@ impl Dialect {
|
|
|
14724
14827
|
| DialectType::Spark
|
|
14725
14828
|
| DialectType::Databricks
|
|
14726
14829
|
| DialectType::ClickHouse
|
|
14830
|
+
| DialectType::StarRocks
|
|
14727
14831
|
) =>
|
|
14728
14832
|
{
|
|
14729
14833
|
let args = f.args;
|
|
@@ -37113,6 +37217,41 @@ impl Dialect {
|
|
|
37113
37217
|
}
|
|
37114
37218
|
}
|
|
37115
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
|
+
|
|
37116
37255
|
// PARSE_TIMESTAMP(format, str) -> target-specific
|
|
37117
37256
|
"PARSE_TIMESTAMP" if args.len() >= 2 => {
|
|
37118
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
|
|
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
|
|
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
|
|
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.
|
|
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.
|
|
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.
|
|
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))
|
|
@@ -22607,6 +22662,36 @@ impl Generator {
|
|
|
22607
22662
|
}
|
|
22608
22663
|
}
|
|
22609
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
|
+
|
|
22610
22695
|
/// Generate LIKE/ILIKE operation with optional ESCAPE clause
|
|
22611
22696
|
fn generate_like_op(&mut self, op: &LikeOp, operator: &str) -> Result<()> {
|
|
22612
22697
|
self.generate_like_op_inner(op, operator, false)
|
|
@@ -22631,6 +22716,51 @@ impl Generator {
|
|
|
22631
22716
|
return self.generate_like_op_inner(op, operator, false);
|
|
22632
22717
|
}
|
|
22633
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
|
+
|
|
22634
22764
|
self.generate_expression(&op.left)?;
|
|
22635
22765
|
self.write_space();
|
|
22636
22766
|
if negated {
|