diff --git a/Cargo.lock b/Cargo.lock index 0330e3dd1..a8988fde6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -164,6 +164,12 @@ dependencies = [ "num-traits", ] +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + [[package]] name = "autocfg" version = "1.3.0" @@ -181,9 +187,9 @@ dependencies = [ "bitflags 1.3.2", "bytes", "futures-util", - "http", - "http-body", - "hyper", + "http 0.2.12", + "http-body 0.4.6", + "hyper 0.14.31", "itoa", "matchit", "memchr", @@ -195,7 +201,7 @@ dependencies = [ "serde_json", "serde_path_to_error", "serde_urlencoded", - "sync_wrapper", + "sync_wrapper 0.1.2", "tokio", "tower", "tower-layer", @@ -211,8 +217,8 @@ dependencies = [ "async-trait", "bytes", "futures-util", - "http", - "http-body", + "http 0.2.12", + "http-body 0.4.6", "mime", "rustversion", "tower-layer", @@ -229,8 +235,8 @@ dependencies = [ "axum-core", "bytes", "futures-util", - "http", - "http-body", + "http 0.2.12", + "http-body 0.4.6", "mime", "pin-project-lite", "serde", @@ -248,10 +254,10 @@ checksum = "298f62fa902c2515c169ab0bfb56c593229f33faa01131215d58e3d4898e3aa9" dependencies = [ "axum", "bytes", - "http", - "http-body", - "hyper", - "reqwest", + "http 0.2.12", + "http-body 0.4.6", + "hyper 0.14.31", + "reqwest 0.11.27", "serde", "tokio", "tower", @@ -971,7 +977,26 @@ dependencies = [ "futures-core", "futures-sink", "futures-util", - "http", + "http 0.2.12", + "indexmap 2.6.0", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "h2" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccae279728d634d083c00f6099cb58f01cc99c145b84b8be2f6c74618d79922e" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http 1.2.0", "indexmap 2.6.0", "slab", "tokio", @@ -1061,6 +1086,17 @@ dependencies = [ "itoa", ] +[[package]] +name = "http" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f16ca2af56261c99fba8bac40a10251ce8188205a4c448fbb745a2e4daa76fea" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + [[package]] name = "http-body" version = "0.4.6" @@ -1068,7 +1104,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ "bytes", - "http", + "http 0.2.12", + "pin-project-lite", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http 1.2.0", +] + +[[package]] +name = "http-body-util" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" +dependencies = [ + "bytes", + "futures-util", + "http 1.2.0", + "http-body 1.0.1", "pin-project-lite", ] @@ -1106,9 +1165,9 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", - "h2", - "http", - "http-body", + "h2 0.3.26", + "http 0.2.12", + "http-body 0.4.6", "httparse", "httpdate", "itoa", @@ -1120,13 +1179,50 @@ dependencies = [ "want", ] +[[package]] +name = "hyper" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97818827ef4f364230e16705d4706e2897df2bb60617d6ca15d598025a3c481f" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "h2 0.4.7", + "http 1.2.0", + "http-body 1.0.1", + "httparse", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" +dependencies = [ + "futures-util", + "http 1.2.0", + "hyper 1.5.1", + "hyper-util", + "rustls 0.23.12", + "rustls-pki-types", + "tokio", + "tokio-rustls 0.26.0", + "tower-service", +] + [[package]] name = "hyper-timeout" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" dependencies = [ - "hyper", + "hyper 0.14.31", "pin-project-lite", "tokio", "tokio-io-timeout", @@ -1139,12 +1235,47 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ "bytes", - "hyper", + "hyper 0.14.31", "native-tls", "tokio", "tokio-native-tls", ] +[[package]] +name = "hyper-tls" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" +dependencies = [ + "bytes", + "http-body-util", + "hyper 1.5.1", + "hyper-util", + "native-tls", + "tokio", + "tokio-native-tls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df2dcfbe0677734ab2f3ffa7fa7bfd4706bfdc1ef393f2ee30184aed67e631b4" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http 1.2.0", + "http-body 1.0.1", + "hyper 1.5.1", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", +] + [[package]] name = "iana-time-zone" version = "0.1.60" @@ -1415,7 +1546,7 @@ dependencies = [ "parking_lot", "percent-encoding", "regex", - "reqwest", + "reqwest 0.11.27", "serde", "serde_json", "time", @@ -1618,8 +1749,8 @@ dependencies = [ [[package]] name = "ndc-models" -version = "0.1.6" -source = "git+https://github.com/hasura/ndc-spec.git?tag=v0.1.6#d1be19e9cdd86ac7b6ad003ff82b7e5b4e96b84f" +version = "0.2.0" +source = "git+https://github.com/hasura/ndc-spec.git?tag=v0.2.0-rc.2#2fad1c699df79890dbb3877d1035ffd8bd0abfc2" dependencies = [ "indexmap 2.6.0", "ref-cast", @@ -1693,17 +1824,16 @@ dependencies = [ [[package]] name = "ndc-sdk" -version = "0.4.0" -source = "git+https://github.com/hasura/ndc-sdk-rs.git?tag=v0.4.0#665509f7d3b47ce4f014fc23f817a3599ba13933" +version = "0.5.0" +source = "git+https://github.com/hasura/ndc-sdk-rs.git?rev=643b96b#643b96b8ee4c8b372b44433167ce2ac4de193332" dependencies = [ "async-trait", "axum", "axum-extra", - "bytes", "clap", - "http", - "mime", + "http 0.2.12", "ndc-models", + "ndc-sdk-core", "ndc-test", "opentelemetry", "opentelemetry-http", @@ -1712,8 +1842,8 @@ dependencies = [ "opentelemetry-zipkin", "opentelemetry_sdk", "prometheus", - "reqwest", - "serde", + "reqwest 0.11.27", + "semver", "serde_json", "thiserror 1.0.69", "tokio", @@ -1724,10 +1854,30 @@ dependencies = [ "url", ] +[[package]] +name = "ndc-sdk-core" +version = "0.5.0" +source = "git+https://github.com/hasura/ndc-sdk-rs.git?rev=643b96b#643b96b8ee4c8b372b44433167ce2ac4de193332" +dependencies = [ + "async-trait", + "axum", + "bytes", + "http 0.2.12", + "mime", + "ndc-models", + "ndc-test", + "prometheus", + "serde", + "serde_json", + "thiserror 1.0.69", + "tokio", + "tracing", +] + [[package]] name = "ndc-test" -version = "0.1.6" -source = "git+https://github.com/hasura/ndc-spec.git?tag=v0.1.6#d1be19e9cdd86ac7b6ad003ff82b7e5b4e96b84f" +version = "0.2.0" +source = "git+https://github.com/hasura/ndc-spec.git?tag=v0.2.0-rc.2#2fad1c699df79890dbb3877d1035ffd8bd0abfc2" dependencies = [ "async-trait", "clap", @@ -1735,14 +1885,12 @@ dependencies = [ "indexmap 2.6.0", "ndc-models", "rand", - "reqwest", + "reqwest 0.12.9", "semver", "serde", "serde_json", - "smol_str", "thiserror 1.0.69", "tokio", - "url", ] [[package]] @@ -1964,9 +2112,9 @@ checksum = "7690dc77bf776713848c4faa6501157469017eaf332baccd4eb1cea928743d94" dependencies = [ "async-trait", "bytes", - "http", + "http 0.2.12", "opentelemetry", - "reqwest", + "reqwest 0.11.27", ] [[package]] @@ -1977,14 +2125,14 @@ checksum = "1a016b8d9495c639af2145ac22387dcb88e44118e45320d9238fbf4e7889abcb" dependencies = [ "async-trait", "futures-core", - "http", + "http 0.2.12", "opentelemetry", "opentelemetry-http", "opentelemetry-proto", "opentelemetry-semantic-conventions", "opentelemetry_sdk", "prost", - "reqwest", + "reqwest 0.11.27", "thiserror 1.0.69", "tokio", "tonic", @@ -2016,13 +2164,13 @@ checksum = "d6943c09b1b7c17b403ae842b00f23e6d5fc6f5ec06cccb3f39aca97094a899a" dependencies = [ "async-trait", "futures-core", - "http", + "http 0.2.12", "once_cell", "opentelemetry", "opentelemetry-http", "opentelemetry-semantic-conventions", "opentelemetry_sdk", - "reqwest", + "reqwest 0.11.27", "serde", "serde_json", "thiserror 1.0.69", @@ -2423,11 +2571,11 @@ dependencies = [ "encoding_rs", "futures-core", "futures-util", - "h2", - "http", - "http-body", - "hyper", - "hyper-tls", + "h2 0.3.26", + "http 0.2.12", + "http-body 0.4.6", + "hyper 0.14.31", + "hyper-tls 0.5.0", "ipnet", "js-sys", "log", @@ -2441,8 +2589,8 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", - "sync_wrapper", - "system-configuration", + "sync_wrapper 0.1.2", + "system-configuration 0.5.1", "tokio", "tokio-native-tls", "tokio-util", @@ -2455,6 +2603,50 @@ dependencies = [ "winreg", ] +[[package]] +name = "reqwest" +version = "0.12.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a77c62af46e79de0a562e1a9849205ffcb7fc1238876e9bd743357570e04046f" +dependencies = [ + "base64 0.22.1", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2 0.4.7", + "http 1.2.0", + "http-body 1.0.1", + "http-body-util", + "hyper 1.5.1", + "hyper-rustls", + "hyper-tls 0.6.0", + "hyper-util", + "ipnet", + "js-sys", + "log", + "mime", + "mime_guess", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite", + "rustls-pemfile 2.1.3", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper 1.0.2", + "system-configuration 0.6.1", + "tokio", + "tokio-native-tls", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "windows-registry", +] + [[package]] name = "ring" version = "0.17.8" @@ -3207,6 +3399,15 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] + [[package]] name = "synstructure" version = "0.13.1" @@ -3226,7 +3427,18 @@ checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" dependencies = [ "bitflags 1.3.2", "core-foundation", - "system-configuration-sys", + "system-configuration-sys 0.5.0", +] + +[[package]] +name = "system-configuration" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" +dependencies = [ + "bitflags 2.6.0", + "core-foundation", + "system-configuration-sys 0.6.0", ] [[package]] @@ -3239,6 +3451,16 @@ dependencies = [ "libc", ] +[[package]] +name = "system-configuration-sys" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "tempfile" version = "3.15.0" @@ -3282,11 +3504,12 @@ dependencies = [ "axum", "axum-test-helper", "env_logger", - "hyper", + "hyper 0.14.31", "ndc-postgres", "ndc-postgres-configuration", "ndc-sdk", "ndc-test", + "reqwest 0.12.9", "reqwest", "schemars", "serde", @@ -3464,6 +3687,17 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-rustls" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" +dependencies = [ + "rustls 0.23.12", + "rustls-pki-types", + "tokio", +] + [[package]] name = "tokio-stream" version = "0.1.15" @@ -3500,10 +3734,10 @@ dependencies = [ "base64 0.21.7", "bytes", "flate2", - "h2", - "http", - "http-body", - "hyper", + "h2 0.3.26", + "http 0.2.12", + "http-body 0.4.6", + "hyper 0.14.31", "hyper-timeout", "percent-encoding", "pin-project", @@ -3512,7 +3746,7 @@ dependencies = [ "rustls-pemfile 2.1.3", "rustls-pki-types", "tokio", - "tokio-rustls", + "tokio-rustls 0.25.0", "tokio-stream", "tower", "tower-layer", @@ -3550,8 +3784,8 @@ dependencies = [ "bytes", "futures-core", "futures-util", - "http", - "http-body", + "http 0.2.12", + "http-body 0.4.6", "http-range-header", "mime", "pin-project-lite", @@ -4001,6 +4235,36 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-registry" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e400001bb720a623c1c69032f8e3e4cf09984deec740f007dd2b03ec864804b0" +dependencies = [ + "windows-result", + "windows-strings", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-result" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-strings" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" +dependencies = [ + "windows-result", + "windows-targets 0.52.6", +] + [[package]] name = "windows-sys" version = "0.48.0" diff --git a/Cargo.toml b/Cargo.toml index ff5734d31..7d5d0115b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,9 +31,9 @@ similar_names = "allow" too_many_lines = "allow" [workspace.dependencies] -ndc-models = { git = "https://github.com/hasura/ndc-spec.git", tag = "v0.1.6" } -ndc-sdk = { git = "https://github.com/hasura/ndc-sdk-rs.git", tag = "v0.4.0" } -ndc-test = { git = "https://github.com/hasura/ndc-spec.git", tag = "v0.1.6" } +ndc-models = { git = "https://github.com/hasura/ndc-spec.git", tag = "v0.2.0-rc.2" } +ndc-sdk = { git = "https://github.com/hasura/ndc-sdk-rs.git", rev = "643b96b" } +ndc-test = { git = "https://github.com/hasura/ndc-spec.git", tag = "v0.2.0-rc.2" } anyhow = "1" async-trait = "0.1" @@ -53,7 +53,7 @@ nonempty = "0.10" percent-encoding = "2" prometheus = "0.13" ref-cast = "1" -reqwest = "0.11" +reqwest = "0.12" schemars = "0.8" serde = "1" serde_json = "1" @@ -61,7 +61,10 @@ serde_yaml = "0.9" similar-asserts = "1" smol_str = "0.1" sqlformat = "0.2" -sqlx = { version = "0.8", default-features = false, features = ["postgres", "derive"] } +sqlx = { version = "0.8", default-features = false, features = [ + "postgres", + "derive", +] } tempfile = "3" test-each = "0.2" thiserror = "1" diff --git a/benchmarks/component/benchmarks/select-order-by.js b/benchmarks/component/benchmarks/select-order-by.js index 376aae225..cdc35e0be 100644 --- a/benchmarks/component/benchmarks/select-order-by.js +++ b/benchmarks/component/benchmarks/select-order-by.js @@ -84,7 +84,7 @@ const data = { collection_relationships: { TrackAlbum: { column_mapping: { - AlbumId: "AlbumId", + AlbumId: ["AlbumId"], }, relationship_type: "object", source_collection_or_type: "Track", diff --git a/crates/configuration/src/version3/comparison.rs b/crates/configuration/src/version3/comparison.rs index bc41eaaf8..fbb6eae6e 100644 --- a/crates/configuration/src/version3/comparison.rs +++ b/crates/configuration/src/version3/comparison.rs @@ -29,22 +29,22 @@ impl ComparisonOperatorMapping { ComparisonOperatorMapping { operator_name: "<=".to_string(), exposed_name: "_lte".to_string(), - operator_kind: OperatorKind::Custom, + operator_kind: OperatorKind::LessThanOrEqual, }, ComparisonOperatorMapping { operator_name: ">".to_string(), exposed_name: "_gt".to_string(), - operator_kind: OperatorKind::Custom, + operator_kind: OperatorKind::GreaterThan, }, ComparisonOperatorMapping { operator_name: ">=".to_string(), exposed_name: "_gte".to_string(), - operator_kind: OperatorKind::Custom, + operator_kind: OperatorKind::GreaterThanOrEqual, }, ComparisonOperatorMapping { operator_name: "<".to_string(), exposed_name: "_lt".to_string(), - operator_kind: OperatorKind::Custom, + operator_kind: OperatorKind::LessThan, }, ComparisonOperatorMapping { operator_name: "<>".to_string(), diff --git a/crates/configuration/src/version3/metadata/database.rs b/crates/configuration/src/version3/metadata/database.rs index d3b3d4671..36097d6dd 100644 --- a/crates/configuration/src/version3/metadata/database.rs +++ b/crates/configuration/src/version3/metadata/database.rs @@ -76,6 +76,10 @@ pub struct ComparisonOperator { pub enum OperatorKind { Equal, In, + LessThan, + LessThanOrEqual, + GreaterThan, + GreaterThanOrEqual, Custom, } diff --git a/crates/configuration/src/version3/mod.rs b/crates/configuration/src/version3/mod.rs index 1dd7cc77b..9f3a0c896 100644 --- a/crates/configuration/src/version3/mod.rs +++ b/crates/configuration/src/version3/mod.rs @@ -5,7 +5,7 @@ pub mod connection_settings; pub mod metadata; pub(crate) mod options; -use ndc_models::{self as models, CollectionName, TypeName}; +use ndc_models::{self as models, CollectionName, ScalarTypeName, TypeName}; use std::borrow::Cow; use std::collections::{BTreeMap, BTreeSet, HashSet}; use std::path::Path; @@ -714,7 +714,10 @@ fn convert_scalar_types( .cloned() .unwrap_or(BTreeMap::new()), - type_representation: representations.0.get(&t).cloned(), + type_representation: convert_or_infer_type_representation( + representations.0.get(&t).cloned(), + &t, + ), }, ) }) @@ -722,6 +725,37 @@ fn convert_scalar_types( ) } +/// Infer scalar type representation from scalar type name, if necessary. Defaults to JSON representation +fn convert_or_infer_type_representation( + representation: Option, + scalar_type_name: &ScalarTypeName, +) -> query_engine_metadata::metadata::TypeRepresentation { + if let Some(representation) = representation { + representation + } else { + match scalar_type_name.as_str() { + "bit" => query_engine_metadata::metadata::TypeRepresentation::String, + "bool" => query_engine_metadata::metadata::TypeRepresentation::Boolean, + "bpchar" | "char" | "varchar" | "text" => { + query_engine_metadata::metadata::TypeRepresentation::String + } + "date" => query_engine_metadata::metadata::TypeRepresentation::Date, + "float4" => query_engine_metadata::metadata::TypeRepresentation::Float32, + "float8" => query_engine_metadata::metadata::TypeRepresentation::Float64, + "int2" => query_engine_metadata::metadata::TypeRepresentation::Int16, + "int4" => query_engine_metadata::metadata::TypeRepresentation::Int32, + "int8" => query_engine_metadata::metadata::TypeRepresentation::Int64AsString, + "numeric" => query_engine_metadata::metadata::TypeRepresentation::BigDecimalAsString, + "time" => query_engine_metadata::metadata::TypeRepresentation::Time, + "timestamp" => query_engine_metadata::metadata::TypeRepresentation::Timestamp, + "timestamptz" => query_engine_metadata::metadata::TypeRepresentation::Timestamptz, + "timetz" => query_engine_metadata::metadata::TypeRepresentation::Timetz, + "uuid" => query_engine_metadata::metadata::TypeRepresentation::UUID, + _ => query_engine_metadata::metadata::TypeRepresentation::Json, + } + } +} + fn convert_aggregate_functions( aggregate_functions: metadata::AggregateFunctions, ) -> BTreeMap< @@ -1020,6 +1054,16 @@ fn convert_operator_kind( match operator_kind { metadata::OperatorKind::Equal => query_engine_metadata::metadata::OperatorKind::Equal, metadata::OperatorKind::In => query_engine_metadata::metadata::OperatorKind::In, + metadata::OperatorKind::LessThan => query_engine_metadata::metadata::OperatorKind::LessThan, + metadata::OperatorKind::LessThanOrEqual => { + query_engine_metadata::metadata::OperatorKind::LessThanOrEqual + } + metadata::OperatorKind::GreaterThan => { + query_engine_metadata::metadata::OperatorKind::GreaterThan + } + metadata::OperatorKind::GreaterThanOrEqual => { + query_engine_metadata::metadata::OperatorKind::GreaterThanOrEqual + } metadata::OperatorKind::Custom => query_engine_metadata::metadata::OperatorKind::Custom, } } diff --git a/crates/configuration/src/version4/comparison.rs b/crates/configuration/src/version4/comparison.rs index 280c1722d..59359172a 100644 --- a/crates/configuration/src/version4/comparison.rs +++ b/crates/configuration/src/version4/comparison.rs @@ -29,22 +29,22 @@ impl ComparisonOperatorMapping { ComparisonOperatorMapping { operator_name: "<=".to_string(), exposed_name: "_lte".to_string(), - operator_kind: OperatorKind::Custom, + operator_kind: OperatorKind::LessThanOrEqual, }, ComparisonOperatorMapping { operator_name: ">".to_string(), exposed_name: "_gt".to_string(), - operator_kind: OperatorKind::Custom, + operator_kind: OperatorKind::GreaterThan, }, ComparisonOperatorMapping { operator_name: ">=".to_string(), exposed_name: "_gte".to_string(), - operator_kind: OperatorKind::Custom, + operator_kind: OperatorKind::GreaterThanOrEqual, }, ComparisonOperatorMapping { operator_name: "<".to_string(), exposed_name: "_lt".to_string(), - operator_kind: OperatorKind::Custom, + operator_kind: OperatorKind::LessThan, }, ComparisonOperatorMapping { operator_name: "<>".to_string(), diff --git a/crates/configuration/src/version4/metadata/database.rs b/crates/configuration/src/version4/metadata/database.rs index cfff6b60f..9bef17023 100644 --- a/crates/configuration/src/version4/metadata/database.rs +++ b/crates/configuration/src/version4/metadata/database.rs @@ -79,6 +79,10 @@ pub struct ComparisonOperator { pub enum OperatorKind { Equal, In, + LessThan, + LessThanOrEqual, + GreaterThan, + GreaterThanOrEqual, Custom, } diff --git a/crates/configuration/src/version4/to_runtime_configuration.rs b/crates/configuration/src/version4/to_runtime_configuration.rs index b4fa402db..0908d524e 100644 --- a/crates/configuration/src/version4/to_runtime_configuration.rs +++ b/crates/configuration/src/version4/to_runtime_configuration.rs @@ -3,7 +3,10 @@ use std::collections::BTreeMap; +use ndc_models::ScalarTypeName; + use super::metadata; +use super::options::IntrospectionOptions; use super::ParsedConfiguration; use crate::environment::Environment; use crate::error::MakeRuntimeConfigurationError; @@ -58,7 +61,7 @@ fn convert_scalar_types( .into_iter() .map(|(scalar_type_name, scalar_type)| { ( - scalar_type_name, + scalar_type_name.clone(), query_engine_metadata::metadata::ScalarType { type_name: scalar_type.type_name, schema_name: Some(scalar_type.schema_name), @@ -73,9 +76,10 @@ fn convert_scalar_types( .into_iter() .map(|(k, v)| (k, convert_comparison_operator(v))) .collect(), - type_representation: scalar_type - .type_representation - .map(convert_type_representation), + type_representation: convert_or_infer_type_representation( + scalar_type.type_representation, + &scalar_type_name, + ), }, ) }) @@ -83,6 +87,24 @@ fn convert_scalar_types( ) } +/// Infer scalar type representation from scalar type name, if necessary. Defaults to JSON representation +fn convert_or_infer_type_representation( + representation: Option, + scalar_type_name: &ScalarTypeName, +) -> query_engine_metadata::metadata::TypeRepresentation { + if let Some(representation) = representation { + convert_type_representation(representation) + } else if let Some(representation) = IntrospectionOptions::default() + .type_representations + .0 + .get(scalar_type_name) + { + convert_type_representation(representation.to_owned()) + } else { + query_engine_metadata::metadata::TypeRepresentation::Json + } +} + fn convert_aggregate_function( aggregate_function: metadata::AggregateFunction, ) -> query_engine_metadata::metadata::AggregateFunction { @@ -327,6 +349,16 @@ fn convert_operator_kind( match operator_kind { metadata::OperatorKind::Equal => query_engine_metadata::metadata::OperatorKind::Equal, metadata::OperatorKind::In => query_engine_metadata::metadata::OperatorKind::In, + metadata::OperatorKind::LessThan => query_engine_metadata::metadata::OperatorKind::LessThan, + metadata::OperatorKind::LessThanOrEqual => { + query_engine_metadata::metadata::OperatorKind::LessThanOrEqual + } + metadata::OperatorKind::GreaterThan => { + query_engine_metadata::metadata::OperatorKind::GreaterThan + } + metadata::OperatorKind::GreaterThanOrEqual => { + query_engine_metadata::metadata::OperatorKind::GreaterThanOrEqual + } metadata::OperatorKind::Custom => query_engine_metadata::metadata::OperatorKind::Custom, } } diff --git a/crates/configuration/src/version4/upgrade_from_v3.rs b/crates/configuration/src/version4/upgrade_from_v3.rs index 1bbe78f45..cf0d6febc 100644 --- a/crates/configuration/src/version4/upgrade_from_v3.rs +++ b/crates/configuration/src/version4/upgrade_from_v3.rs @@ -156,6 +156,14 @@ fn upgrade_operator_kind( match operator_kind { version3::metadata::OperatorKind::Equal => metadata::OperatorKind::Equal, version3::metadata::OperatorKind::In => metadata::OperatorKind::In, + version3::metadata::OperatorKind::LessThan => metadata::OperatorKind::LessThan, + version3::metadata::OperatorKind::LessThanOrEqual => { + metadata::OperatorKind::LessThanOrEqual + } + version3::metadata::OperatorKind::GreaterThan => metadata::OperatorKind::GreaterThan, + version3::metadata::OperatorKind::GreaterThanOrEqual => { + metadata::OperatorKind::GreaterThanOrEqual + } version3::metadata::OperatorKind::Custom => metadata::OperatorKind::Custom, } } diff --git a/crates/configuration/src/version5/comparison.rs b/crates/configuration/src/version5/comparison.rs index 280c1722d..59359172a 100644 --- a/crates/configuration/src/version5/comparison.rs +++ b/crates/configuration/src/version5/comparison.rs @@ -29,22 +29,22 @@ impl ComparisonOperatorMapping { ComparisonOperatorMapping { operator_name: "<=".to_string(), exposed_name: "_lte".to_string(), - operator_kind: OperatorKind::Custom, + operator_kind: OperatorKind::LessThanOrEqual, }, ComparisonOperatorMapping { operator_name: ">".to_string(), exposed_name: "_gt".to_string(), - operator_kind: OperatorKind::Custom, + operator_kind: OperatorKind::GreaterThan, }, ComparisonOperatorMapping { operator_name: ">=".to_string(), exposed_name: "_gte".to_string(), - operator_kind: OperatorKind::Custom, + operator_kind: OperatorKind::GreaterThanOrEqual, }, ComparisonOperatorMapping { operator_name: "<".to_string(), exposed_name: "_lt".to_string(), - operator_kind: OperatorKind::Custom, + operator_kind: OperatorKind::LessThan, }, ComparisonOperatorMapping { operator_name: "<>".to_string(), diff --git a/crates/configuration/src/version5/metadata/database.rs b/crates/configuration/src/version5/metadata/database.rs index ae77ca441..78522218f 100644 --- a/crates/configuration/src/version5/metadata/database.rs +++ b/crates/configuration/src/version5/metadata/database.rs @@ -85,6 +85,10 @@ pub struct ComparisonOperator { pub enum OperatorKind { Equal, In, + LessThan, + LessThanOrEqual, + GreaterThan, + GreaterThanOrEqual, Custom, } diff --git a/crates/configuration/src/version5/to_runtime_configuration.rs b/crates/configuration/src/version5/to_runtime_configuration.rs index 222f4364c..483df2a19 100644 --- a/crates/configuration/src/version5/to_runtime_configuration.rs +++ b/crates/configuration/src/version5/to_runtime_configuration.rs @@ -3,7 +3,10 @@ use std::collections::BTreeMap; +use ndc_models::ScalarTypeName; + use super::metadata; +use super::options::IntrospectionOptions; use super::ParsedConfiguration; use crate::environment::Environment; use crate::error::MakeRuntimeConfigurationError; @@ -58,7 +61,7 @@ fn convert_scalar_types( .into_iter() .map(|(scalar_type_name, scalar_type)| { ( - scalar_type_name, + scalar_type_name.clone(), query_engine_metadata::metadata::ScalarType { type_name: scalar_type.type_name, schema_name: Some(scalar_type.schema_name), @@ -73,9 +76,10 @@ fn convert_scalar_types( .into_iter() .map(|(k, v)| (k, convert_comparison_operator(v))) .collect(), - type_representation: scalar_type - .type_representation - .map(convert_type_representation), + type_representation: convert_or_infer_type_representation( + scalar_type.type_representation, + &scalar_type_name, + ), }, ) }) @@ -83,6 +87,24 @@ fn convert_scalar_types( ) } +/// Infer scalar type representation from scalar type name, if necessary. Defaults to JSON representation +fn convert_or_infer_type_representation( + representation: Option, + scalar_type_name: &ScalarTypeName, +) -> query_engine_metadata::metadata::TypeRepresentation { + if let Some(representation) = representation { + convert_type_representation(representation) + } else if let Some(representation) = IntrospectionOptions::default() + .type_representations + .0 + .get(scalar_type_name) + { + convert_type_representation(representation.to_owned()) + } else { + query_engine_metadata::metadata::TypeRepresentation::Json + } +} + fn convert_aggregate_function( aggregate_function: metadata::AggregateFunction, ) -> query_engine_metadata::metadata::AggregateFunction { @@ -324,6 +346,16 @@ fn convert_operator_kind( match operator_kind { metadata::OperatorKind::Equal => query_engine_metadata::metadata::OperatorKind::Equal, metadata::OperatorKind::In => query_engine_metadata::metadata::OperatorKind::In, + metadata::OperatorKind::LessThan => query_engine_metadata::metadata::OperatorKind::LessThan, + metadata::OperatorKind::LessThanOrEqual => { + query_engine_metadata::metadata::OperatorKind::LessThanOrEqual + } + metadata::OperatorKind::GreaterThan => { + query_engine_metadata::metadata::OperatorKind::GreaterThan + } + metadata::OperatorKind::GreaterThanOrEqual => { + query_engine_metadata::metadata::OperatorKind::GreaterThanOrEqual + } metadata::OperatorKind::Custom => query_engine_metadata::metadata::OperatorKind::Custom, } } diff --git a/crates/configuration/src/version5/upgrade_from_v4.rs b/crates/configuration/src/version5/upgrade_from_v4.rs index 7e25c0c23..e841866d4 100644 --- a/crates/configuration/src/version5/upgrade_from_v4.rs +++ b/crates/configuration/src/version5/upgrade_from_v4.rs @@ -77,6 +77,14 @@ fn upgrade_operator_kind( match operator_kind { version4::metadata::OperatorKind::Equal => metadata::OperatorKind::Equal, version4::metadata::OperatorKind::In => metadata::OperatorKind::In, + version4::metadata::OperatorKind::LessThan => metadata::OperatorKind::LessThan, + version4::metadata::OperatorKind::LessThanOrEqual => { + metadata::OperatorKind::LessThanOrEqual + } + version4::metadata::OperatorKind::GreaterThan => metadata::OperatorKind::GreaterThan, + version4::metadata::OperatorKind::GreaterThanOrEqual => { + metadata::OperatorKind::GreaterThanOrEqual + } version4::metadata::OperatorKind::Custom => metadata::OperatorKind::Custom, } } diff --git a/crates/connectors/ndc-postgres/src/capabilities.rs b/crates/connectors/ndc-postgres/src/capabilities.rs index 91a42fa0b..0564c7636 100644 --- a/crates/connectors/ndc-postgres/src/capabilities.rs +++ b/crates/connectors/ndc-postgres/src/capabilities.rs @@ -9,16 +9,25 @@ use ndc_sdk::models; pub fn get_capabilities() -> models::Capabilities { models::Capabilities { query: models::QueryCapabilities { - aggregates: Some(models::LeafCapability {}), + aggregates: Some(models::AggregateCapabilities { + filter_by: None, + group_by: None, + }), variables: Some(models::LeafCapability {}), explain: Some(models::LeafCapability {}), exists: models::ExistsCapabilities { nested_collections: Some(models::LeafCapability {}), + named_scopes: None, + unrelated: None, + nested_scalar_collections: None, }, nested_fields: models::NestedFieldCapabilities { - filter_by: Some(models::LeafCapability {}), + filter_by: Some(models::NestedFieldFilterByCapabilities { + nested_arrays: None, + }), order_by: Some(models::LeafCapability {}), - aggregates: None, + aggregates: Some(models::LeafCapability {}), + nested_collections: None, }, }, mutation: models::MutationCapabilities { @@ -28,6 +37,7 @@ pub fn get_capabilities() -> models::Capabilities { relationships: Some(models::RelationshipCapabilities { relation_comparisons: Some(models::LeafCapability {}), order_by_aggregate: Some(models::LeafCapability {}), + nested: None, }), } } diff --git a/crates/connectors/ndc-postgres/src/connector.rs b/crates/connectors/ndc-postgres/src/connector.rs index 71672b541..93743458d 100644 --- a/crates/connectors/ndc-postgres/src/connector.rs +++ b/crates/connectors/ndc-postgres/src/connector.rs @@ -188,14 +188,14 @@ impl PostgresSetup { } #[async_trait] -impl ConnectorSetup for PostgresSetup { +impl ConnectorSetup for PostgresSetup { type Connector = Postgres; /// Validate the raw configuration provided by the user, /// returning a configuration error or a validated `Connector::Configuration`. async fn parse_configuration( &self, - configuration_dir: impl AsRef + Send, + configuration_dir: &Path, ) -> Result<::Configuration> { // Note that we don't log validation errors, because they are part of the normal business // operation of configuration validation, i.e. they don't represent an error condition that diff --git a/crates/connectors/ndc-postgres/src/schema/mod.rs b/crates/connectors/ndc-postgres/src/schema/mod.rs index dfcec3a75..0ac22649b 100644 --- a/crates/connectors/ndc-postgres/src/schema/mod.rs +++ b/crates/connectors/ndc-postgres/src/schema/mod.rs @@ -30,25 +30,39 @@ pub fn get_schema( .iter() .map(|(scalar_type_name, scalar_type_info)| { let result = models::ScalarType { - representation: scalar_type_info - .type_representation - .as_ref() - .map(map_type_representation), + representation: map_type_representation(&scalar_type_info.type_representation), aggregate_functions: scalar_type_info .aggregate_functions .iter() .map(|(function_name, function_definition)| { ( function_name.clone(), - models::AggregateFunctionDefinition { - result_type: models::Type::Nullable { - // It turns out that all aggregates defined for postgres - // (_except_ `COUNT`) will return `NULL` for an empty row set. - // Thus, we mark all aggregates as having a nullable return - // type. - underlying_type: Box::new(models::Type::Named { - name: function_definition.return_type.clone(), - }), + match ( + function_name.as_str(), + function_definition.return_type.as_str(), + ) { + ("sum", "float8" | "int8") => { + models::AggregateFunctionDefinition::Sum { + result_type: function_definition.return_type.clone().into(), + } + } + ("max", _) => models::AggregateFunctionDefinition::Max, + ("min", _) => models::AggregateFunctionDefinition::Min, + // Mark AVG aggregations returning a f64 (float8) with the meaning tag + // The spec wants all averages to return a scalar represented as a f64 + ("avg", "float8") => models::AggregateFunctionDefinition::Average { + result_type: function_definition.return_type.clone().into(), + }, + (_, _) => models::AggregateFunctionDefinition::Custom { + result_type: models::Type::Nullable { + // It turns out that all aggregates defined for postgres + // (_except_ `COUNT`) will return `NULL` for an empty row set. + // Thus, we mark all aggregates as having a nullable return + // type. + underlying_type: Box::new(models::Type::Named { + name: function_definition.return_type.clone(), + }), + }, }, }, ) @@ -67,6 +81,18 @@ pub fn get_schema( metadata::OperatorKind::In => { models::ComparisonOperatorDefinition::In } + metadata::OperatorKind::LessThan => { + models::ComparisonOperatorDefinition::LessThan + } + metadata::OperatorKind::LessThanOrEqual => { + models::ComparisonOperatorDefinition::LessThanOrEqual + } + metadata::OperatorKind::GreaterThan => { + models::ComparisonOperatorDefinition::GreaterThan + } + metadata::OperatorKind::GreaterThanOrEqual => { + models::ComparisonOperatorDefinition::GreaterThanOrEqual + } metadata::OperatorKind::Custom => { models::ComparisonOperatorDefinition::Custom { argument_type: models::Type::Named { @@ -119,42 +145,6 @@ pub fn get_schema( }, ) .collect(), - foreign_keys: table - .foreign_relations - .0 - .iter() - .map( - |( - constraint_name, - metadata::ForeignRelation { - foreign_schema, - foreign_table, - column_mapping, - }, - )| { - ( - constraint_name.clone(), - models::ForeignKeyConstraint { - foreign_collection: (*collections_by_identifier - .get(&( - // the foreign schema used to be implied, so if it is not - // provided, we need to default back to the originating - // table's schema - foreign_schema.as_ref().unwrap_or(&table.schema_name), - foreign_table, - )) - .unwrap_or_else(|| { - panic!( - "Unknown foreign table: {foreign_schema:?}.{foreign_table:?}" - ) - })) - .into(), - column_mapping: column_mapping.clone(), - }, - ) - }, - ) - .collect(), }) .collect(); @@ -181,7 +171,6 @@ pub fn get_schema( .collect(), collection_type: name.as_str().into(), uniqueness_constraints: BTreeMap::new(), - foreign_keys: BTreeMap::new(), }) .collect(); @@ -209,6 +198,42 @@ pub fn get_schema( ) }) .collect(), + foreign_keys: table + .foreign_relations + .0 + .iter() + .map( + |( + constraint_name, + metadata::ForeignRelation { + foreign_schema, + foreign_table, + column_mapping, + }, + )| { + ( + constraint_name.clone(), + models::ForeignKeyConstraint { + foreign_collection: (*collections_by_identifier + .get(&( + // the foreign schema used to be implied, so if it is not + // provided, we need to default back to the originating + // table's schema + foreign_schema.as_ref().unwrap_or(&table.schema_name), + foreign_table, + )) + .unwrap_or_else(|| { + panic!( + "Unknown foreign table: {foreign_schema:?}.{foreign_table:?}" + ) + })) + .into(), + column_mapping: column_mapping.clone().into_iter().map(|(left_col, right_col)| (left_col, vec![right_col])).collect(), + }, + ) + }, + ) + .collect(), }; (collection_name.as_str().into(), object_type) }) @@ -236,6 +261,7 @@ pub fn get_schema( ) }) .collect(), + foreign_keys: BTreeMap::new(), }; (nq_name.as_str().into(), object_type) }) @@ -263,6 +289,7 @@ pub fn get_schema( ) }) .collect(), + foreign_keys: BTreeMap::new(), }; (nq_name.as_str().into(), object_type) }) @@ -291,6 +318,7 @@ pub fn get_schema( ) }) .collect(), + foreign_keys: BTreeMap::new(), }; (ctype_name.as_str().into(), object_type) }) @@ -351,12 +379,32 @@ pub fn get_schema( procedures.extend(generated_procedures); object_types.extend(more_object_types); + // If int8 doesn't exist anywhere else in the schema, we need to add it here. However, a user + // can't filter or aggregate based on the result of a cout aggregation, so we don't need to add + // any aggregate functions or comparison operators. However, if int8 exists elsewhere in the + // schema and has already been added, it will also already contain these functions and + // operators. + scalar_types + .entry("int8".into()) + .or_insert(models::ScalarType { + representation: models::TypeRepresentation::Int64, + aggregate_functions: BTreeMap::new(), + comparison_operators: BTreeMap::new(), + }); + Ok(models::SchemaResponse { collections, procedures, functions: vec![], object_types, scalar_types, + capabilities: Some(models::CapabilitySchemaInfo { + query: Some(models::QueryCapabilitiesSchemaInfo { + aggregates: Some(models::AggregateCapabilitiesSchemaInfo { + count_scalar_type: "int8".to_string(), + }), + }), + }), }) } diff --git a/crates/connectors/ndc-postgres/src/schema/mutation/helpers.rs b/crates/connectors/ndc-postgres/src/schema/mutation/helpers.rs index a3d15b76a..6f2784736 100644 --- a/crates/connectors/ndc-postgres/src/schema/mutation/helpers.rs +++ b/crates/connectors/ndc-postgres/src/schema/mutation/helpers.rs @@ -33,7 +33,7 @@ pub fn make_procedure_type( scalar_types .entry("int4".into()) .or_insert(models::ScalarType { - representation: Some(models::TypeRepresentation::Int32), + representation: models::TypeRepresentation::Int32, aggregate_functions: BTreeMap::new(), comparison_operators: BTreeMap::new(), }); @@ -65,6 +65,7 @@ pub fn make_procedure_type( models::ObjectType { description: Some(format!("Responses from the '{name}' procedure")), fields, + foreign_keys: BTreeMap::new(), }, ); @@ -102,6 +103,7 @@ pub fn make_insert_objects_type( models::ObjectType { description: None, fields, + foreign_keys: BTreeMap::new(), } } @@ -135,6 +137,7 @@ pub fn make_update_column_type( "Update the '{column_name}' column in the '{collection_name}' collection" )), fields, + foreign_keys: BTreeMap::new(), }, )) } diff --git a/crates/connectors/ndc-postgres/src/schema/mutation/v2.rs b/crates/connectors/ndc-postgres/src/schema/mutation/v2.rs index c04f8365f..e7435bb60 100644 --- a/crates/connectors/ndc-postgres/src/schema/mutation/v2.rs +++ b/crates/connectors/ndc-postgres/src/schema/mutation/v2.rs @@ -155,6 +155,7 @@ pub fn update_to_procedure( update_by_key.collection_name )), fields, + foreign_keys: BTreeMap::new(), }, ); diff --git a/crates/query-engine/metadata/src/metadata/database.rs b/crates/query-engine/metadata/src/metadata/database.rs index 21e07de38..33298e9a1 100644 --- a/crates/query-engine/metadata/src/metadata/database.rs +++ b/crates/query-engine/metadata/src/metadata/database.rs @@ -30,7 +30,7 @@ pub struct ScalarType { pub description: Option, pub aggregate_functions: BTreeMap, pub comparison_operators: BTreeMap, - pub type_representation: Option, + pub type_representation: TypeRepresentation, } /// Map of all known composite types. @@ -77,6 +77,10 @@ pub struct ComparisonOperator { pub enum OperatorKind { Equal, In, + LessThan, + LessThanOrEqual, + GreaterThan, + GreaterThanOrEqual, Custom, } diff --git a/crates/query-engine/sql/src/sql/ast.rs b/crates/query-engine/sql/src/sql/ast.rs index 871ed4d5d..310ad2fbf 100644 --- a/crates/query-engine/sql/src/sql/ast.rs +++ b/crates/query-engine/sql/src/sql/ast.rs @@ -338,11 +338,11 @@ pub enum Function { } /// COUNT clause -#[derive(Debug, Clone, PartialEq, Eq)] +#[derive(Debug, Clone, PartialEq)] pub enum CountType { Star, - Simple(ColumnReference), - Distinct(ColumnReference), + Simple(Box), + Distinct(Box), } /// Value diff --git a/crates/query-engine/translation/src/translation/error.rs b/crates/query-engine/translation/src/translation/error.rs index 29f2307bf..8c2d11ece 100644 --- a/crates/query-engine/translation/src/translation/error.rs +++ b/crates/query-engine/translation/src/translation/error.rs @@ -12,6 +12,10 @@ pub enum Error { ColumnNotFoundInCollection(models::FieldName, models::CollectionName), RelationshipNotFound(models::RelationshipName), ArgumentNotFound(models::ArgumentName), + UnexpectedArgumentValue { + expected: String, + got: String, + }, OperatorNotFound { operator_name: models::ComparisonOperatorName, type_name: models::ScalarTypeName, @@ -54,18 +58,46 @@ pub enum Error { field_name: models::FieldName, actual_type: Type, }, + MutationVersionNotSet, + MissingAggregateFunctionForScalar { + scalar: models::ScalarTypeName, + function: models::AggregateFunctionName, + }, + ScopeOutOfBounds { + current_collection_name: String, + tables_in_scope_names: Vec, + scope: usize, + }, } /// Capabilities we don't currently support. #[derive(Debug, Clone)] pub enum UnsupportedCapabilities { FieldArguments, + NestedRelationships, + NestedCollectionFields, + NestedArrays, + ArrayComparison, + NestedScalarCollection, + FilterByAggregate, } impl std::fmt::Display for UnsupportedCapabilities { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { match self { UnsupportedCapabilities::FieldArguments => write!(f, "Field arguments"), + UnsupportedCapabilities::NestedRelationships => write!(f, "Nested relationships"), + UnsupportedCapabilities::NestedCollectionFields => { + write!(f, "Nested collection fields") + } + UnsupportedCapabilities::NestedArrays => { + write!(f, "Nested arrays") + } + UnsupportedCapabilities::ArrayComparison => write!(f, "Array Comparison"), + UnsupportedCapabilities::NestedScalarCollection => { + write!(f, "Nested Scalar Collection") + } + UnsupportedCapabilities::FilterByAggregate => write!(f, "Filter By Aggregate"), } } } @@ -93,6 +125,12 @@ impl std::fmt::Display for Error { Error::ArgumentNotFound(argument) => { write!(f, "Argument '{argument}' not found.") } + Error::UnexpectedArgumentValue { expected, got } => { + write!( + f, + "Unexpected argument value, expected {expected}, got {got}" + ) + } Error::OperatorNotFound { operator_name, type_name, @@ -199,6 +237,31 @@ impl std::fmt::Display for Error { "Nested field '{field_name}' not of array type. Actual type: {actual_type:?}" ) } + Error::MutationVersionNotSet => write!(f, "Mutation version not set"), + Error::MissingAggregateFunctionForScalar { scalar, function } => write!( + f, + "Missing single column aggregate function {function:?} for scalar type {scalar:?}" + ), + Error::ScopeOutOfBounds { + current_collection_name, + tables_in_scope_names, + scope, + } => { + write!( + f, + "Scope {scope} out of bounds. Current collection is {current_collection_name}. Collections in scope: [" + )?; + let mut first = true; + for collection in tables_in_scope_names { + if first { + first = false; + } else { + write!(f, ", ")?; + } + write!(f, "{collection}")?; + } + write!(f, "].") + } } } } diff --git a/crates/query-engine/translation/src/translation/helpers.rs b/crates/query-engine/translation/src/translation/helpers.rs index f5f8aec07..72af034e8 100644 --- a/crates/query-engine/translation/src/translation/helpers.rs +++ b/crates/query-engine/translation/src/translation/helpers.rs @@ -1,6 +1,6 @@ //! Helpers for processing requests and building SQL. -use std::collections::BTreeMap; +use std::collections::{BTreeMap, VecDeque}; use ndc_models as models; @@ -47,16 +47,68 @@ pub struct NativeQueryInfo { pub alias: sql::ast::TableAlias, } -/// For the root table in the query, and for the current table we are processing, +/// For the current table we are processing, and all ancestor table up to the closest Query, /// We'd like to track what is their reference in the query (the name we can use to address them, /// an alias we generate), and what is their name in the metadata (so we can get /// their information such as which columns are available for that table). #[derive(Debug, Clone, PartialEq, Eq)] -pub struct RootAndCurrentTables { - /// The root (top-most) table in the query. - pub root_table: TableSourceAndReference, +pub struct TableScope { /// The current table we are processing. - pub current_table: TableSourceAndReference, + current_table: TableSourceAndReference, + /// Tables in scope. Index 0 corresponds to scope 1, which is the table immediately above the current table in the exists chain. + tables_in_scope: VecDeque, +} + +impl TableScope { + /// Create a scope from a Query. There will be no tables available through scopes + pub fn new(current_table: TableSourceAndReference) -> Self { + Self { + current_table, + tables_in_scope: VecDeque::new(), + } + } + /// Create a scope from an exists expression or path. The ancestor tables up until the closest query will stay in scope + #[must_use] + pub fn new_from_scope(&self, current_table: TableSourceAndReference) -> Self { + let TableScope { + current_table: parent_table, + tables_in_scope, + } = self; + let mut tables_in_scope = tables_in_scope.clone(); + tables_in_scope.push_front(parent_table.clone()); + Self { + current_table, + tables_in_scope, + } + } + /// Get the table source and reference for the current table + pub fn current_table(&self) -> &TableSourceAndReference { + &self.current_table + } + /// Get the table source and reference for a table in scope. + /// The scope is an index, where 0 is the current table, 1 is the parent, and so on + /// Errors if the scope is out of bounds + pub fn scoped_table(&self, scope: &Option) -> Result<&TableSourceAndReference, Error> { + if let Some(scope) = scope { + if *scope > 0 && *scope <= self.tables_in_scope.len() { + Ok(&self.tables_in_scope[scope - 1]) + } else if *scope == 0 { + Ok(&self.current_table) + } else { + Err(Error::ScopeOutOfBounds { + current_collection_name: self.current_table.source.name_for_alias(), + tables_in_scope_names: self + .tables_in_scope + .iter() + .map(|c| c.source.name_for_alias()) + .collect(), + scope: *scope, + }) + } + } else { + Ok(&self.current_table) + } + } } /// For a table in the query, We'd like to track what is its reference in the query @@ -424,7 +476,7 @@ impl<'request> Env<'request> { .scalar_types .0 .get(scalar_type) - .and_then(|t| t.type_representation.as_ref()) + .map(|t| &t.type_representation) } /// Try to get the variables table reference. This will fail if no variables were passed diff --git a/crates/query-engine/translation/src/translation/mutation/translate.rs b/crates/query-engine/translation/src/translation/mutation/translate.rs index 240925f74..bb62d272d 100644 --- a/crates/query-engine/translation/src/translation/mutation/translate.rs +++ b/crates/query-engine/translation/src/translation/mutation/translate.rs @@ -74,6 +74,7 @@ fn translate_mutation( offset: None, order_by: None, predicate: None, + groups: None, }; let (return_collection, cte_expr, check_constraint_alias) = @@ -217,6 +218,7 @@ fn translate_native_query( offset: None, order_by: None, predicate: None, + groups: None, }; // process inner query and get the SELECTs for the 'rows' and 'aggregates' fields. @@ -316,8 +318,20 @@ pub fn parse_procedure_fields( .to_string(), ))? } + ndc_models::NestedField::Collection(_) => { + Err(Error::UnexpectedStructure( + "nested field collection in array in 'returning' clause" + .to_string(), + ))? + } } } + ndc_models::NestedField::Collection(_) => { + Err(Error::UnexpectedStructure( + "nested field collection array in 'returning' clause" + .to_string(), + ))? + } }, None => returning, }; @@ -338,6 +352,9 @@ pub fn parse_procedure_fields( Some(models::NestedField::Array(_)) => { Err(Error::NotImplementedYet("nested array fields".to_string())) } + Some(models::NestedField::Collection(_)) => Err(Error::NotImplementedYet( + "nested field collection".to_string(), + )), None => Err(Error::NoProcedureResultFieldsRequested)?, } } @@ -357,7 +374,7 @@ fn translate_mutation_expr( Error, > { match env.mutations_version { - None => todo!(), + None => Err(Error::MutationVersionNotSet), Some(metadata::mutations::MutationsVersion::V1) => { v1::translate(env, state, procedure_name, arguments) } diff --git a/crates/query-engine/translation/src/translation/mutation/v1/insert.rs b/crates/query-engine/translation/src/translation/mutation/v1/insert.rs index d65cd4bd6..ceb2af567 100644 --- a/crates/query-engine/translation/src/translation/mutation/v1/insert.rs +++ b/crates/query-engine/translation/src/translation/mutation/v1/insert.rs @@ -69,7 +69,18 @@ pub fn translate( )); } } - _ => todo!(), + _ => Err(Error::UnexpectedArgumentValue { + expected: "Object".into(), + got: match object { + serde_json::Value::Null => "Null", + serde_json::Value::Bool(_) => "Bool", + serde_json::Value::Number(_) => "Number", + serde_json::Value::String(_) => "String", + serde_json::Value::Array(_) => "Array", + serde_json::Value::Object(_) => "Object", + } + .into(), + })?, }; check_columns(&mutation.columns, &columns, &mutation.collection_name)?; diff --git a/crates/query-engine/translation/src/translation/mutation/v2/delete.rs b/crates/query-engine/translation/src/translation/mutation/v2/delete.rs index b7d9516e3..b535b7e20 100644 --- a/crates/query-engine/translation/src/translation/mutation/v2/delete.rs +++ b/crates/query-engine/translation/src/translation/mutation/v2/delete.rs @@ -156,10 +156,7 @@ pub fn translate( let predicate_expression = filtering::translate( env, state, - &helpers::RootAndCurrentTables { - root_table: table_name_and_reference.clone(), - current_table: table_name_and_reference, - }, + &helpers::TableScope::new(table_name_and_reference), &predicate, )?; diff --git a/crates/query-engine/translation/src/translation/mutation/v2/insert.rs b/crates/query-engine/translation/src/translation/mutation/v2/insert.rs index e264290e6..0199fff90 100644 --- a/crates/query-engine/translation/src/translation/mutation/v2/insert.rs +++ b/crates/query-engine/translation/src/translation/mutation/v2/insert.rs @@ -245,10 +245,7 @@ pub fn translate( let predicate_expression = filtering::translate( env, state, - &helpers::RootAndCurrentTables { - root_table: table_name_and_reference.clone(), - current_table: table_name_and_reference, - }, + &helpers::TableScope::new(table_name_and_reference), &predicate, )?; diff --git a/crates/query-engine/translation/src/translation/mutation/v2/update.rs b/crates/query-engine/translation/src/translation/mutation/v2/update.rs index 970d62958..e8bb6e9f0 100644 --- a/crates/query-engine/translation/src/translation/mutation/v2/update.rs +++ b/crates/query-engine/translation/src/translation/mutation/v2/update.rs @@ -151,10 +151,7 @@ pub fn translate( }) .collect::, Error>>()?; - let root_and_current_tables = helpers::RootAndCurrentTables { - root_table: table_name_and_reference.clone(), - current_table: table_name_and_reference, - }; + let root_and_current_tables = helpers::TableScope::new(table_name_and_reference); // Set default constrainst let default_constraint = default_constraint(); diff --git a/crates/query-engine/translation/src/translation/query/aggregates.rs b/crates/query-engine/translation/src/translation/query/aggregates.rs index 2885628d4..9e736d446 100644 --- a/crates/query-engine/translation/src/translation/query/aggregates.rs +++ b/crates/query-engine/translation/src/translation/query/aggregates.rs @@ -4,7 +4,7 @@ use indexmap::IndexMap; use ndc_models as models; -use crate::translation::error::Error; +use crate::translation::{error::Error, helpers::wrap_in_field_path}; use query_engine_sql::sql; /// Translate any aggregates we should include in the query into our SQL AST. @@ -19,38 +19,61 @@ pub fn translate( models::Aggregate::ColumnCount { column, distinct, - field_path: _, + field_path, + arguments: _, } => { let count_column_alias = sql::helpers::make_column_alias(column.to_string()); - if *distinct { - sql::ast::Expression::Count(sql::ast::CountType::Distinct( + + let column = wrap_in_field_path( + &field_path.into(), + sql::ast::Expression::ColumnReference( sql::ast::ColumnReference::AliasedColumn { table: table.clone(), column: count_column_alias, }, - )) + ), + ); + + if *distinct { + sql::ast::Expression::Count(sql::ast::CountType::Distinct(Box::new(column))) } else { - sql::ast::Expression::Count(sql::ast::CountType::Simple( - sql::ast::ColumnReference::AliasedColumn { - table: table.clone(), - column: count_column_alias, - }, - )) + sql::ast::Expression::Count(sql::ast::CountType::Simple(Box::new(column))) } } models::Aggregate::SingleColumn { column, function, - field_path: _, - } => sql::ast::Expression::FunctionCall { - function: sql::ast::Function::Unknown(function.to_string()), - args: vec![sql::ast::Expression::ColumnReference( - sql::ast::ColumnReference::AliasedColumn { - table: table.clone(), - column: sql::helpers::make_column_alias(column.to_string()), - }, - )], - }, + field_path, + arguments: _, + } => { + let column = wrap_in_field_path( + &field_path.into(), + sql::ast::Expression::ColumnReference( + sql::ast::ColumnReference::AliasedColumn { + table: table.clone(), + column: sql::helpers::make_column_alias(column.to_string()), + }, + ), + ); + let aggregate_function_call_expression = sql::ast::Expression::FunctionCall { + function: sql::ast::Function::Unknown(function.to_string()), + args: vec![column], + }; + // postgres SUM aggregate returns null if no input rows are provided + // however, the ndc spec requires that SUM aggregates over no input rows return 0 + // we achieve this with COALESCE, falling back to 0 if the aggregate expression returns null + if function.as_str() == "sum" { + sql::ast::Expression::FunctionCall { + function: sql::ast::Function::Coalesce, + args: vec![ + aggregate_function_call_expression, + sql::ast::Expression::Value(sql::ast::Value::Int4(0)), + ], + } + } else { + aggregate_function_call_expression + } + } models::Aggregate::StarCount {} => { sql::ast::Expression::Count(sql::ast::CountType::Star) } diff --git a/crates/query-engine/translation/src/translation/query/fields.rs b/crates/query-engine/translation/src/translation/query/fields.rs index 8282f7d6d..332dd1df8 100644 --- a/crates/query-engine/translation/src/translation/query/fields.rs +++ b/crates/query-engine/translation/src/translation/query/fields.rs @@ -279,8 +279,14 @@ fn translate_nested_field( fields, )) } + ndc_models::NestedField::Collection(_) => Err(Error::CapabilityNotSupported( + UnsupportedCapabilities::NestedCollectionFields, + )), } } + ndc_models::NestedField::Collection(_) => Err(Error::CapabilityNotSupported( + UnsupportedCapabilities::NestedCollectionFields, + )), }?; // The recursive call to the next layer of fields diff --git a/crates/query-engine/translation/src/translation/query/filtering.rs b/crates/query-engine/translation/src/translation/query/filtering.rs index 73b1e3763..6c648393c 100644 --- a/crates/query-engine/translation/src/translation/query/filtering.rs +++ b/crates/query-engine/translation/src/translation/query/filtering.rs @@ -13,7 +13,7 @@ use super::variables; use crate::translation::error::Error; use crate::translation::error::UnsupportedCapabilities; use crate::translation::helpers::{ - wrap_in_field_path, ColumnInfo, CompositeTypeInfo, Env, FieldPath, RootAndCurrentTables, State, + wrap_in_field_path, ColumnInfo, CompositeTypeInfo, Env, FieldPath, State, TableScope, TableSource, TableSourceAndReference, }; use query_engine_metadata::metadata::database; @@ -24,12 +24,12 @@ use std::collections::VecDeque; pub fn translate( env: &Env, state: &mut State, - root_and_current_tables: &RootAndCurrentTables, + current_table_scope: &TableScope, predicate: &models::Expression, ) -> Result { // Fetch the filter expression and the relevant joins. let (filter_expression, joins) = - translate_expression_with_joins(env, state, root_and_current_tables, predicate)?; + translate_expression_with_joins(env, state, current_table_scope, predicate)?; let mut joins = VecDeque::from(joins); let filter = match joins.pop_front() { @@ -54,7 +54,7 @@ pub fn translate( pub fn translate_expression_with_joins( env: &Env, state: &mut State, - root_and_current_tables: &RootAndCurrentTables, + current_table_scope: &TableScope, predicate: &models::Expression, ) -> Result<(sql::ast::Expression, Vec), Error> { match predicate { @@ -62,9 +62,7 @@ pub fn translate_expression_with_joins( let mut acc_joins = vec![]; let and_exprs = expressions .iter() - .map(|expr| { - translate_expression_with_joins(env, state, root_and_current_tables, expr) - }) + .map(|expr| translate_expression_with_joins(env, state, current_table_scope, expr)) .try_fold( sql::ast::Expression::Value(sql::ast::Value::Bool(true)), |acc, expr| { @@ -82,9 +80,7 @@ pub fn translate_expression_with_joins( let mut acc_joins = vec![]; let or_exprs = expressions .iter() - .map(|expr| { - translate_expression_with_joins(env, state, root_and_current_tables, expr) - }) + .map(|expr| translate_expression_with_joins(env, state, current_table_scope, expr)) .try_fold( sql::ast::Expression::Value(sql::ast::Value::Bool(false)), |acc, expr| { @@ -100,7 +96,7 @@ pub fn translate_expression_with_joins( } models::Expression::Not { expression } => { let (expr, joins) = - translate_expression_with_joins(env, state, root_and_current_tables, expression)?; + translate_expression_with_joins(env, state, current_table_scope, expression)?; Ok((sql::ast::Expression::Not(Box::new(expr)), joins)) } models::Expression::BinaryComparisonOperator { @@ -108,22 +104,39 @@ pub fn translate_expression_with_joins( operator, value, } => { - let left_typ = get_comparison_target_type(env, root_and_current_tables, column)?; + let left_typ = get_comparison_target_type(env, current_table_scope, column)?; let op = env.lookup_comparison_operator(&left_typ, operator)?; if op.operator_kind == metadata::OperatorKind::In { let mut joins = vec![]; let (left, left_joins) = - translate_comparison_target(env, state, root_and_current_tables, column)?; + translate_comparison_target(env, state, current_table_scope, column)?; joins.extend(left_joins); match value { - models::ComparisonValue::Column { column } => { - let (right, right_joins) = translate_comparison_target( - env, - state, - root_and_current_tables, - column, - )?; + models::ComparisonValue::Column { + path, + name, + arguments: _, + field_path, + scope, + } => { + let scoped_table = current_table_scope.scoped_table(scope)?; + let (table_ref, right_joins) = + translate_comparison_pathelements(env, state, scoped_table, path)?; + + let collection_info = env.lookup_fields_info(&table_ref.source)?; + let ColumnInfo { name, .. } = collection_info.lookup_column(name)?; + + let right = wrap_in_field_path( + &field_path.into(), + sql::ast::Expression::ColumnReference( + sql::ast::ColumnReference::TableColumn { + table: table_ref.reference.clone(), + name, + }, + ), + ); + joins.extend(right_joins); let right = vec![make_unnest_subquery(state, right)]; @@ -149,7 +162,7 @@ pub fn translate_expression_with_joins( let (right, right_joins) = translate_comparison_value( env, state, - root_and_current_tables, + current_table_scope, &models::ComparisonValue::Scalar { value: value.clone(), }, @@ -179,7 +192,7 @@ pub fn translate_expression_with_joins( let (right, right_joins) = translate_comparison_value( env, state, - root_and_current_tables, + current_table_scope, value, &array_type, )?; @@ -200,13 +213,13 @@ pub fn translate_expression_with_joins( } else { let mut joins = vec![]; let (left, left_joins) = - translate_comparison_target(env, state, root_and_current_tables, column)?; + translate_comparison_target(env, state, current_table_scope, column)?; joins.extend(left_joins); let (right, right_joins) = translate_comparison_value( env, state, - root_and_current_tables, + current_table_scope, value, &database::Type::ScalarType(op.argument_type.clone()), )?; @@ -242,7 +255,7 @@ pub fn translate_expression_with_joins( translate_exists_in_collection( env, state, - root_and_current_tables, + current_table_scope, in_collection.clone(), predicate, )?, @@ -252,7 +265,7 @@ pub fn translate_expression_with_joins( models::Expression::UnaryComparisonOperator { column, operator } => match operator { models::UnaryComparisonOperator::IsNull => { let (value, joins) = - translate_comparison_target(env, state, root_and_current_tables, column)?; + translate_comparison_target(env, state, current_table_scope, column)?; Ok(( sql::ast::Expression::UnaryOperation { @@ -263,6 +276,9 @@ pub fn translate_expression_with_joins( )) } }, + models::Expression::ArrayComparison { .. } => Err(Error::CapabilityNotSupported( + UnsupportedCapabilities::ArrayComparison, + )), } } @@ -308,11 +324,10 @@ pub fn translate_expression_with_joins( fn translate_comparison_pathelements( env: &Env, state: &mut State, - root_and_current_tables: &RootAndCurrentTables, + current_table: &TableSourceAndReference, path: &[models::PathElement], ) -> Result<(TableSourceAndReference, Vec), Error> { let mut joins = vec![]; - let RootAndCurrentTables { current_table, .. } = root_and_current_tables; let final_ref = path.iter().try_fold( current_table.clone(), @@ -321,6 +336,7 @@ fn translate_comparison_pathelements( relationship, predicate, arguments, + field_path: _, }| { // get the relationship table let relationship_name = &relationship; @@ -352,20 +368,16 @@ fn translate_comparison_pathelements( select.select_list = sql::ast::SelectList::SelectStar; - let new_root_and_current_tables = RootAndCurrentTables { - root_table: root_and_current_tables.root_table.clone(), - current_table: TableSourceAndReference { - reference: table.reference.clone(), - source: table.source.clone(), - }, - }; + // for the purposes of named scopes, PathElement functions as a root, much like Query + let new_current_table_scope = TableScope::new(table.clone()); + // relationship-specfic filter let (rel_cond, rel_joins) = match predicate { None => (sql::helpers::true_expr(), vec![]), Some(predicate) => translate_expression_with_joins( env, state, - &new_root_and_current_tables, + &new_current_table_scope, predicate, )?, }; @@ -390,7 +402,7 @@ fn translate_comparison_pathelements( }, )); - Ok(new_root_and_current_tables.current_table) + Ok(table) }, )?; @@ -416,7 +428,6 @@ fn translate_comparison_pathelements( reference, source: final_ref.source, }, - // create a join from the select. // We use a full outer join so even if one of the sides does not contain rows, // We can still select values. // See a more elaborated explanation: https://github.com/hasura/ndc-postgres/pull/463#discussion_r1601884534 @@ -434,18 +445,17 @@ fn translate_comparison_pathelements( /// translate a comparison target. fn translate_comparison_target( env: &Env, - state: &mut State, - root_and_current_tables: &RootAndCurrentTables, + _state: &mut State, + current_table_scope: &TableScope, column: &models::ComparisonTarget, ) -> Result<(sql::ast::Expression, Vec), Error> { match column { models::ComparisonTarget::Column { name, - path, field_path, + arguments: _, } => { - let (table_ref, joins) = - translate_comparison_pathelements(env, state, root_and_current_tables, path)?; + let (table_ref, joins) = (current_table_scope.current_table().clone(), vec![]); // get the unrelated table information from the metadata. let collection_info = env.lookup_fields_info(&table_ref.source)?; @@ -462,42 +472,48 @@ fn translate_comparison_target( joins, )) } + ndc_models::ComparisonTarget::Aggregate { .. } => Err(Error::CapabilityNotSupported( + UnsupportedCapabilities::FilterByAggregate, + )), + } +} - // Compare a column from the root table. - models::ComparisonTarget::RootCollectionColumn { name, field_path } => { - let RootAndCurrentTables { root_table, .. } = root_and_current_tables; - // get the unrelated table information from the metadata. - let collection_info = env.lookup_fields_info(&root_table.source)?; +/// translate a comparison value. +fn translate_comparison_value( + env: &Env, + state: &mut State, + current_table_scope: &TableScope, + value: &models::ComparisonValue, + typ: &database::Type, +) -> Result<(sql::ast::Expression, Vec), Error> { + match value { + models::ComparisonValue::Column { + path, + name, + arguments: _, + field_path, + scope, + } => { + let table_source_and_reference = current_table_scope.scoped_table(scope)?; - // find the requested column in the tables columns. + let (table_ref, joins) = + translate_comparison_pathelements(env, state, table_source_and_reference, path)?; + + // get the unrelated table information from the metadata. + let collection_info = env.lookup_fields_info(&table_ref.source)?; let ColumnInfo { name, .. } = collection_info.lookup_column(name)?; Ok(( wrap_in_field_path( &field_path.into(), sql::ast::Expression::ColumnReference(sql::ast::ColumnReference::TableColumn { - table: root_table.reference.clone(), + table: table_ref.reference.clone(), name, }), ), - vec![], + joins, )) } - } -} - -/// translate a comparison value. -fn translate_comparison_value( - env: &Env, - state: &mut State, - root_and_current_tables: &RootAndCurrentTables, - value: &models::ComparisonValue, - typ: &database::Type, -) -> Result<(sql::ast::Expression, Vec), Error> { - match value { - models::ComparisonValue::Column { column } => { - translate_comparison_target(env, state, root_and_current_tables, column) - } models::ComparisonValue::Scalar { value: json_value } => { Ok((values::translate(env, state, json_value, typ)?, vec![])) } @@ -514,7 +530,7 @@ fn translate_comparison_value( pub fn translate_exists_in_collection( env: &Env, state: &mut State, - root_and_current_tables: &RootAndCurrentTables, + current_table_scope: &TableScope, in_collection: models::ExistsInCollection, predicate: &models::Expression, ) -> Result { @@ -546,20 +562,10 @@ pub fn translate_exists_in_collection( let mut select = sql::helpers::simple_select(select_cols); select.from = Some(from_clause); - let new_root_and_current_tables = RootAndCurrentTables { - root_table: root_and_current_tables.root_table.clone(), - current_table: TableSourceAndReference { - reference: table.reference, - source: table.source, - }, - }; + let new_current_table_scope = current_table_scope.new_from_scope(table); - let (expr, expr_joins) = translate_expression_with_joins( - env, - state, - &new_root_and_current_tables, - predicate, - )?; + let (expr, expr_joins) = + translate_expression_with_joins(env, state, &new_current_table_scope, predicate)?; select.where_ = sql::ast::Where(expr); select.joins = expr_joins; @@ -575,6 +581,7 @@ pub fn translate_exists_in_collection( models::ExistsInCollection::Related { relationship, arguments, + field_path: _, } => { // get the relationship table let relationship = env.lookup_relationship(&relationship)?; @@ -607,26 +614,16 @@ pub fn translate_exists_in_collection( let mut select = sql::helpers::simple_select(select_cols); select.from = Some(from_clause); - let new_root_and_current_tables = RootAndCurrentTables { - root_table: root_and_current_tables.root_table.clone(), - current_table: TableSourceAndReference { - reference: table.reference.clone(), - source: table.source, - }, - }; + let new_current_table_scope = current_table_scope.new_from_scope(table.clone()); // exists condition - let (exists_cond, exists_joins) = translate_expression_with_joins( - env, - state, - &new_root_and_current_tables, - predicate, - )?; + let (exists_cond, exists_joins) = + translate_expression_with_joins(env, state, &new_current_table_scope, predicate)?; // relationship where clause let cond = relationships::translate_column_mapping( env, - &root_and_current_tables.current_table, + current_table_scope.current_table(), &table.reference, exists_cond, relationship, @@ -652,7 +649,7 @@ pub fn translate_exists_in_collection( UnsupportedCapabilities::FieldArguments, ))?; } - let table = &root_and_current_tables.current_table; + let table = current_table_scope.current_table(); // Get the table information from the metadata. let collection_fields_info = env.lookup_fields_info(&table.source)?; @@ -718,21 +715,15 @@ pub fn translate_exists_in_collection( // Define a new root and current table structure pointing the current table // at the nested field. - let new_root_and_current_tables = RootAndCurrentTables { - root_table: root_and_current_tables.root_table.clone(), - current_table: TableSourceAndReference { + let new_current_table_scope = + current_table_scope.new_from_scope(TableSourceAndReference { reference: sql::ast::TableReference::AliasedTable(alias), source, - }, - }; + }); // Translate the predicate inside the exists. - let (exists_cond, exists_joins) = translate_expression_with_joins( - env, - state, - &new_root_and_current_tables, - predicate, - )?; + let (exists_cond, exists_joins) = + translate_expression_with_joins(env, state, &new_current_table_scope, predicate)?; // Construct the `where exists` expression. Ok(sql::helpers::where_exists_select( @@ -741,54 +732,99 @@ pub fn translate_exists_in_collection( sql::ast::Where(exists_cond), )) } + ndc_models::ExistsInCollection::NestedScalarCollection { + column_name: _, + arguments: _, + field_path: _, + } => Err(Error::CapabilityNotSupported( + UnsupportedCapabilities::NestedScalarCollection, + )), } } /// Extract the scalar type of a comparison target fn get_comparison_target_type( env: &Env, - root_and_current_tables: &RootAndCurrentTables, + current_table_scope: &TableScope, column: &models::ComparisonTarget, ) -> Result { match column { - models::ComparisonTarget::RootCollectionColumn { name, field_path } => { - let column = env - .lookup_fields_info(&root_and_current_tables.root_table.source)? - .lookup_column(name)?; - - let mut field_path = match field_path { - None => VecDeque::new(), - Some(field_path) => field_path.iter().collect(), - }; - get_column_scalar_type_name(env, &column.r#type, &mut field_path) - } + // models::ComparisonTarget::RootCollectionColumn { name, field_path } => { + // let column = env + // .lookup_fields_info(&root_and_current_tables.root_table.source)? + // .lookup_column(name)?; + + // let mut field_path = match field_path { + // None => VecDeque::new(), + // Some(field_path) => field_path.iter().collect(), + // }; + // get_column_scalar_type_name(env, &column.r#type, &mut field_path) + // } models::ComparisonTarget::Column { name, - path, field_path, + arguments: _, } => { let mut field_path = match field_path { None => VecDeque::new(), Some(field_path) => field_path.iter().collect(), }; - match path.last() { - None => { - let column = env - .lookup_fields_info(&root_and_current_tables.current_table.source)? - .lookup_column(name)?; + let column = env + .lookup_fields_info(¤t_table_scope.current_table().source)? + .lookup_column(name)?; - get_column_scalar_type_name(env, &column.r#type, &mut field_path) + get_column_scalar_type_name(env, &column.r#type, &mut field_path) + } + ndc_models::ComparisonTarget::Aggregate { path, aggregate } => { + match aggregate { + ndc_models::Aggregate::StarCount {} | ndc_models::Aggregate::ColumnCount { .. } => { + Ok("int8".into()) } - Some(last) => { - let column = env - .lookup_fields_info(&TableSource::Collection( - env.lookup_relationship(&last.relationship)? - .target_collection - .clone(), - ))? - .lookup_column(name)?; - - get_column_scalar_type_name(env, &column.r#type, &mut field_path) + ndc_models::Aggregate::SingleColumn { + column, + arguments: _, + field_path, + function, + } => { + // figure out column type, then get type for that aggregate from metadata + let mut field_path = match field_path { + None => VecDeque::new(), + Some(field_path) => field_path.iter().collect(), + }; + + let scalar_type_name = match path.last() { + None => { + let column = env + .lookup_fields_info(¤t_table_scope.current_table().source)? + .lookup_column(column)?; + + get_column_scalar_type_name(env, &column.r#type, &mut field_path)? + } + Some(last) => { + let column = env + .lookup_fields_info(&TableSource::Collection( + env.lookup_relationship(&last.relationship)? + .target_collection + .clone(), + ))? + .lookup_column(column)?; + + get_column_scalar_type_name(env, &column.r#type, &mut field_path)? + } + }; + + let scalar_type = env.metadata.scalar_types.0.get(&scalar_type_name); + + let aggregate_function = scalar_type + .ok_or(Error::ScalarTypeNotFound(scalar_type_name.clone()))? + .aggregate_functions + .get(function) + .ok_or(Error::MissingAggregateFunctionForScalar { + scalar: scalar_type_name, + function: function.to_owned(), + })?; + + Ok(aggregate_function.return_type.clone().into()) } } } diff --git a/crates/query-engine/translation/src/translation/query/relationships.rs b/crates/query-engine/translation/src/translation/query/relationships.rs index eab8c54b7..0e9eb08d4 100644 --- a/crates/query-engine/translation/src/translation/query/relationships.rs +++ b/crates/query-engine/translation/src/translation/query/relationships.rs @@ -5,7 +5,7 @@ use std::collections::BTreeMap; use ndc_models as models; use super::root; -use crate::translation::error::Error; +use crate::translation::error::{Error, UnsupportedCapabilities}; use crate::translation::helpers::{Env, State, TableSourceAndReference}; use query_engine_sql::sql; @@ -99,6 +99,14 @@ pub fn translate_column_mapping( .iter() .map(|(source_col, target_col)| { let source_column_info = table_info.lookup_column(source_col)?; + // target_col contains at least one element, the column being referenced + // if nested relationships are supported, it additionally contains the path to navigate to the related column + // we currently don't support nested relationships, so erring out if the pattern does not match + let [target_col] = target_col.as_slice() else { + return Err(Error::CapabilityNotSupported( + UnsupportedCapabilities::NestedRelationships, + )); + }; let target_column_info = target_collection_info.lookup_column(target_col)?; Ok(sql::ast::Expression::BinaryOperation { left: Box::new(sql::ast::Expression::ColumnReference( diff --git a/crates/query-engine/translation/src/translation/query/root.rs b/crates/query-engine/translation/src/translation/query/root.rs index debbb53ae..7dfba5339 100644 --- a/crates/query-engine/translation/src/translation/query/root.rs +++ b/crates/query-engine/translation/src/translation/query/root.rs @@ -14,7 +14,7 @@ use super::sorting; use crate::translation::error::Error; use crate::translation::helpers::TableSource; use crate::translation::helpers::{ - CollectionInfo, Env, RootAndCurrentTables, State, TableSourceAndReference, + CollectionInfo, Env, State, TableScope, TableSourceAndReference, }; use query_engine_sql::sql; @@ -173,26 +173,18 @@ pub fn translate_query_part( query: &models::Query, select: &mut sql::ast::Select, ) -> Result<(), Error> { - // the root table and the current table are the same at this point - let root_and_current_tables = RootAndCurrentTables { - root_table: current_table.clone(), - current_table: current_table.clone(), - }; + let current_table_scope = TableScope::new(current_table.clone()); // translate order_by - let (order_by, order_by_joins) = sorting::translate( - env, - state, - &root_and_current_tables, - query.order_by.as_ref(), - )?; + let (order_by, order_by_joins) = + sorting::translate(env, state, ¤t_table_scope, query.order_by.as_ref())?; select.joins.extend(order_by_joins); // translate where let filter = match &query.predicate { None => Ok(sql::helpers::true_expr()), - Some(predicate) => filtering::translate(env, state, &root_and_current_tables, predicate), + Some(predicate) => filtering::translate(env, state, ¤t_table_scope, predicate), }?; // Apply a join predicate if we want one. diff --git a/crates/query-engine/translation/src/translation/query/sorting.rs b/crates/query-engine/translation/src/translation/query/sorting.rs index 71f901916..982c509cc 100644 --- a/crates/query-engine/translation/src/translation/query/sorting.rs +++ b/crates/query-engine/translation/src/translation/query/sorting.rs @@ -10,7 +10,7 @@ use super::relationships; use super::root; use crate::translation::error::Error; use crate::translation::helpers::{ - wrap_in_field_path, Env, FieldPath, FieldsInfo, RootAndCurrentTables, State, TableSource, + wrap_in_field_path, Env, FieldPath, FieldsInfo, State, TableScope, TableSource, TableSourceAndReference, }; use query_engine_sql::sql; @@ -22,7 +22,7 @@ use query_engine_sql::sql; pub fn translate( env: &Env, state: &mut State, - root_and_current_tables: &RootAndCurrentTables, + current_table_scope: &TableScope, order_by: Option<&models::OrderBy>, ) -> Result<(sql::ast::OrderBy, Vec), Error> { let mut joins: Vec = vec![]; @@ -40,7 +40,7 @@ pub fn translate( translate_order_by_target_group( env, state, - root_and_current_tables, + current_table_scope, element_group, &mut joins, ) @@ -97,11 +97,15 @@ struct Column(models::FieldName); /// An aggregate operation to select from a table used in an order by. #[derive(Debug)] enum Aggregate { - CountStarAggregate, - SingleColumnAggregate { + StarCount, + SingleColumn { column: models::FieldName, function: models::AggregateFunctionName, }, + ColumnCount { + column: models::FieldName, + distinct: bool, + }, } impl OrderByElementGroup<'_> { @@ -143,6 +147,7 @@ fn group_elements(elements: &[models::OrderByElement]) -> Vec Vec column_element_groups.insert( hash_path(path), ( @@ -165,32 +171,54 @@ fn group_elements(elements: &[models::OrderByElement]) -> Vec aggregate_element_groups.insert( - hash_path(path), - ( - i, - path, - element.order_direction, - Aggregate::CountStarAggregate, + models::OrderByTarget::Aggregate { path, aggregate } => match aggregate { + models::Aggregate::ColumnCount { + column, + arguments: _, + field_path, + distinct, + } => aggregate_element_groups.insert( + hash_path(path), + ( + i, + path, + field_path.into(), + element.order_direction, + Aggregate::ColumnCount { + column: column.clone(), + distinct: *distinct, + }, + ), ), - ), - models::OrderByTarget::SingleColumnAggregate { - path, - column, - function, - field_path: _, - } => aggregate_element_groups.insert( - hash_path(path), - ( - i, - path, - element.order_direction, - Aggregate::SingleColumnAggregate { - column: column.clone(), - function: function.clone(), - }, + models::Aggregate::SingleColumn { + column, + arguments: _, + function, + field_path, + } => aggregate_element_groups.insert( + hash_path(path), + ( + i, + path, + field_path.into(), + element.order_direction, + Aggregate::SingleColumn { + column: column.clone(), + function: function.clone(), + }, + ), ), - ), + models::Aggregate::StarCount {} => aggregate_element_groups.insert( + hash_path(path), + ( + i, + path, + (&None).into(), + element.order_direction, + Aggregate::StarCount, + ), + ), + }, } } @@ -219,7 +247,7 @@ fn group_elements(elements: &[models::OrderByElement]) -> Vec Vec, ) -> Result, Error> { - let column_or_relationship_select = build_select_and_joins_for_order_by_group( - env, - state, - root_and_current_tables, - element_group, - )?; + let column_or_relationship_select = + build_select_and_joins_for_order_by_group(env, state, current_table_scope, element_group)?; match column_or_relationship_select { // The column is from the source table, we just need to query it directly. @@ -275,8 +299,8 @@ fn translate_order_by_target_group( ColumnsOrSelect::Select { columns, select } => { // Give it a nice unique alias. let table_alias = state.make_order_by_table_alias( - root_and_current_tables - .current_table + current_table_scope + .current_table() .source .name_for_alias() .as_str(), @@ -353,7 +377,7 @@ enum ColumnsOrSelect { fn build_select_and_joins_for_order_by_group( env: &Env, state: &mut State, - root_and_current_tables: &RootAndCurrentTables, + current_table_scope: &TableScope, element_group: &OrderByElementGroup, ) -> Result { // We want to build a select query where "Track" is the root table, and "Artist"."Name" @@ -387,26 +411,22 @@ fn build_select_and_joins_for_order_by_group( } OrderByElementGroup::Columns { .. } => { // If the path is empty, we don't need to build a query, just return the columns. - let table = - env.lookup_fields_info(&root_and_current_tables.current_table.source)?; - let columns = translate_targets( - &table, - &root_and_current_tables.current_table, - element_group, - )? - .into_iter() - .map(|column| { - ( - column.index, - column.direction, - column.field_path, - sql::ast::ColumnReference::AliasedColumn { - table: root_and_current_tables.current_table.reference.clone(), - column: column.alias, - }, - ) - }) - .collect(); + let table = env.lookup_fields_info(¤t_table_scope.current_table().source)?; + let columns = + translate_targets(&table, current_table_scope.current_table(), element_group)? + .into_iter() + .map(|column| { + ( + column.index, + column.direction, + column.field_path, + sql::ast::ColumnReference::AliasedColumn { + table: current_table_scope.current_table().reference.clone(), + column: column.alias, + }, + ) + }) + .collect(); Ok(ColumnsOrSelect::Columns(columns)) } } @@ -420,7 +440,7 @@ fn build_select_and_joins_for_order_by_group( // from the next join, we need to select these. let (last_table, cols) = path.iter().enumerate().try_fold( ( - root_and_current_tables.current_table.clone(), + current_table_scope.current_table().clone(), // this is a dummy value that will be ignored, since we only care about returning // the columns from the last table. PathElementSelectColumns::RelationshipColumns(vec![]), @@ -428,7 +448,6 @@ fn build_select_and_joins_for_order_by_group( |(last_table, _), (index, path_element)| { process_path_element_for_order_by_targets( (env, state), - root_and_current_tables, element_group, &mut joins, (last_table, (index, path_element)), @@ -459,9 +478,23 @@ fn build_select_and_joins_for_order_by_group( // apply an aggregate function if needed. match &select_expr.aggregate { None => column, - Some(function) => sql::ast::Expression::FunctionCall { - function: function.clone(), - args: vec![column], + Some(aggregate) => match aggregate { + OrderByAggregate::Function { function } => { + sql::ast::Expression::FunctionCall { + function: function.clone(), + args: vec![column], + } + } + OrderByAggregate::CountStar | OrderByAggregate::Count => { + sql::ast::Expression::Count( + sql::ast::CountType::Simple(Box::new(column)), + ) + } + OrderByAggregate::CountDistinct => { + sql::ast::Expression::Count( + sql::ast::CountType::Distinct(Box::new(column)), + ) + } }, } }) @@ -537,8 +570,16 @@ struct OrderBySelectExpression { field_path: FieldPath, alias: sql::ast::ColumnAlias, expression: sql::ast::Expression, - aggregate: Option, + aggregate: Option, } + +enum OrderByAggregate { + Function { function: sql::ast::Function }, + CountStar, + Count, + CountDistinct, +} + /// An expression selected from an intermediate relationship table. struct OrderByRelationshipColumn { alias: sql::ast::ColumnAlias, @@ -551,7 +592,6 @@ struct OrderByRelationshipColumn { /// from the next join, we need to select these. fn process_path_element_for_order_by_targets( (env, state): (&Env, &mut State), - root_and_current_tables: &RootAndCurrentTables, element_group: &OrderByElementGroup, // to get the information about this path element we need to select from the relevant table // and join with the previous table. We add a new join to this list of joins. @@ -627,10 +667,7 @@ fn process_path_element_for_order_by_targets( let select = select_for_path_element( env, state, - &RootAndCurrentTables { - root_table: root_and_current_tables.root_table.clone(), - current_table: last_table, - }, + &last_table, relationship, path_element.predicate.as_deref(), sql::ast::SelectList::SelectList(select_cols.aliases_and_expressions()), @@ -694,7 +731,7 @@ fn translate_targets( .iter() .map(|element| { match &element.element { - Aggregate::CountStarAggregate => { + Aggregate::StarCount => { let column_alias = sql::helpers::make_column_alias("count".to_string()); Ok(OrderBySelectExpression { index: element.index, @@ -703,10 +740,10 @@ fn translate_targets( // Aggregates do not have a field path. field_path: (&None).into(), expression: sql::ast::Expression::Value(sql::ast::Value::Int4(1)), - aggregate: Some(sql::ast::Function::Unknown("COUNT".to_string())), + aggregate: Some(OrderByAggregate::CountStar), }) } - Aggregate::SingleColumnAggregate { column, function } => { + Aggregate::SingleColumn { column, function } => { let selected_column = target_collection.lookup_column(column)?; // we are going to deliberately use the table column name and not an alias we get from // the query request because this is internal to the sorting mechanism. @@ -725,7 +762,33 @@ fn translate_targets( column: selected_column_alias, }, ), - aggregate: Some(sql::ast::Function::Unknown(function.to_string())), + aggregate: Some(OrderByAggregate::Function { + function: sql::ast::Function::Unknown(function.to_string()), + }), + }) + } + Aggregate::ColumnCount { column, distinct } => { + let selected_column = target_collection.lookup_column(column)?; + let selected_column_alias = + sql::helpers::make_column_alias(selected_column.name.0); + + Ok(OrderBySelectExpression { + index: element.index, + direction: element.direction, + alias: selected_column_alias.clone(), + // Aggregates do not have a field path. + field_path: (&None).into(), + expression: sql::ast::Expression::ColumnReference( + sql::ast::ColumnReference::AliasedColumn { + table: table.reference.clone(), + column: selected_column_alias, + }, + ), + aggregate: Some(if *distinct { + OrderByAggregate::CountDistinct + } else { + OrderByAggregate::Count + }), }) } } @@ -765,7 +828,7 @@ fn from_clause_for_path_element( fn select_for_path_element( env: &Env, state: &mut State, - root_and_current_tables: &RootAndCurrentTables, + current_table: &TableSourceAndReference, relationship: &models::Relationship, predicate: Option<&models::Expression>, select_list: sql::ast::SelectList, @@ -776,16 +839,14 @@ fn select_for_path_element( select.select_list = select_list; select.from = Some(from_clause); - let predicate_tables = RootAndCurrentTables { - root_table: root_and_current_tables.root_table.clone(), - current_table: join_table, - }; + // path elements get a fresh scope each, and cannot use named scopes to access other tables in the path + let predicate_tables = TableScope::new(join_table); // generate a condition for this join. let join_condition = relationships::translate_column_mapping( env, - &root_and_current_tables.current_table, - &predicate_tables.current_table.reference, + current_table, + &predicate_tables.current_table().reference, sql::helpers::empty_where(), relationship, )?; diff --git a/crates/query-engine/translation/tests/goldenfiles/dup_array_relationship/request.json b/crates/query-engine/translation/tests/goldenfiles/dup_array_relationship/request.json index 4fa7b4d17..6d74fa7e3 100644 --- a/crates/query-engine/translation/tests/goldenfiles/dup_array_relationship/request.json +++ b/crates/query-engine/translation/tests/goldenfiles/dup_array_relationship/request.json @@ -38,7 +38,7 @@ "collection_relationships": { "ArtistAlbums": { "column_mapping": { - "ArtistId": "ArtistId" + "ArtistId": ["ArtistId"] }, "relationship_type": "array", "target_collection": "Album", diff --git a/crates/query-engine/translation/tests/goldenfiles/native_queries/select_artist_with_album_by_title/request.json b/crates/query-engine/translation/tests/goldenfiles/native_queries/select_artist_with_album_by_title/request.json index c9b5dd3cf..2a06aa885 100644 --- a/crates/query-engine/translation/tests/goldenfiles/native_queries/select_artist_with_album_by_title/request.json +++ b/crates/query-engine/translation/tests/goldenfiles/native_queries/select_artist_with_album_by_title/request.json @@ -45,7 +45,7 @@ "collection_relationships": { "Albums": { "column_mapping": { - "ArtistId": "ArtistId" + "ArtistId": ["ArtistId"] }, "relationship_type": "array", "target_collection": "album_by_title", diff --git a/crates/query-engine/translation/tests/goldenfiles/native_queries/select_artist_with_album_by_title_relationship_arguments/request.json b/crates/query-engine/translation/tests/goldenfiles/native_queries/select_artist_with_album_by_title_relationship_arguments/request.json index b94ce2f5b..4b6f0512b 100644 --- a/crates/query-engine/translation/tests/goldenfiles/native_queries/select_artist_with_album_by_title_relationship_arguments/request.json +++ b/crates/query-engine/translation/tests/goldenfiles/native_queries/select_artist_with_album_by_title_relationship_arguments/request.json @@ -57,7 +57,7 @@ "collection_relationships": { "Albums": { "column_mapping": { - "ArtistId": "ArtistId" + "ArtistId": ["ArtistId"] }, "relationship_type": "array", "target_collection": "album_by_title", diff --git a/crates/query-engine/translation/tests/goldenfiles/nested_aggregates/request.json b/crates/query-engine/translation/tests/goldenfiles/nested_aggregates/request.json index e08bf0303..33c8ad81d 100644 --- a/crates/query-engine/translation/tests/goldenfiles/nested_aggregates/request.json +++ b/crates/query-engine/translation/tests/goldenfiles/nested_aggregates/request.json @@ -35,7 +35,7 @@ "collection_relationships": { "ArtistToAlbums": { "column_mapping": { - "ArtistId": "ArtistId" + "ArtistId": ["ArtistId"] }, "relationship_type": "array", "target_collection": "Album", diff --git a/crates/query-engine/translation/tests/goldenfiles/nested_array_relationships/request.json b/crates/query-engine/translation/tests/goldenfiles/nested_array_relationships/request.json index 2235da7da..c1d37ce07 100644 --- a/crates/query-engine/translation/tests/goldenfiles/nested_array_relationships/request.json +++ b/crates/query-engine/translation/tests/goldenfiles/nested_array_relationships/request.json @@ -32,7 +32,7 @@ "collection_relationships": { "ArtistAlbums": { "column_mapping": { - "ArtistId": "ArtistId" + "ArtistId": ["ArtistId"] }, "relationship_type": "array", "target_collection": "Album", @@ -40,7 +40,7 @@ }, "AlbumTracks": { "column_mapping": { - "AlbumId": "AlbumId" + "AlbumId": ["AlbumId"] }, "relationship_type": "array", "target_collection": "Track", diff --git a/crates/query-engine/translation/tests/goldenfiles/nested_recursive_relationship/request.json b/crates/query-engine/translation/tests/goldenfiles/nested_recursive_relationship/request.json index 69545d9ac..a97cc560b 100644 --- a/crates/query-engine/translation/tests/goldenfiles/nested_recursive_relationship/request.json +++ b/crates/query-engine/translation/tests/goldenfiles/nested_recursive_relationship/request.json @@ -32,7 +32,7 @@ "collection_relationships": { "ArtistAlbums": { "column_mapping": { - "ArtistId": "ArtistId" + "ArtistId": ["ArtistId"] }, "relationship_type": "array", "target_collection": "Album", @@ -40,7 +40,7 @@ }, "AlbumArtist": { "column_mapping": { - "ArtistId": "ArtistId" + "ArtistId": ["ArtistId"] }, "relationship_type": "object", "target_collection": "Artist", diff --git a/crates/query-engine/translation/tests/goldenfiles/select_composite_column_nested_field_count/configuration.json b/crates/query-engine/translation/tests/goldenfiles/select_composite_column_nested_field_count/configuration.json new file mode 100644 index 000000000..423a3bd98 --- /dev/null +++ b/crates/query-engine/translation/tests/goldenfiles/select_composite_column_nested_field_count/configuration.json @@ -0,0 +1,415 @@ +{ + "version": "5", + "$schema": "../../../../../../static/configuration.schema.json", + "connectionSettings": { + "connectionUri": { + "variable": "CONNECTION_URI" + }, + "poolSettings": { + "maxConnections": 50, + "poolTimeout": 30, + "idleTimeout": 180, + "checkConnectionAfterIdle": 60, + "connectionLifetime": 600 + }, + "isolationLevel": "ReadCommitted" + }, + "metadata": { + "tables": { + "persons": { + "schemaName": "public", + "tableName": "persons", + "columns": { + "id": { + "name": "id", + "type": { + "scalarType": "int4" + }, + "nullable": "nullable", + "description": null + }, + "person": { + "name": "person", + "type": { + "compositeType": "person" + }, + "nullable": "nullable", + "description": null + } + }, + "uniquenessConstraints": {}, + "foreignRelations": {}, + "description": null + } + }, + "types": { + "scalar": { + "text": { + "typeName": "text", + "schemaName": "pg_catalog", + "description": null, + "aggregateFunctions": {}, + "comparisonOperators": {}, + "typeRepresentation": "string" + }, + "int4": { + "typeName": "int4", + "schemaName": "pg_catalog", + "description": null, + "aggregateFunctions": {}, + "comparisonOperators": {}, + "typeRepresentation": "int32" + } + }, + "composite": { + "person": { + "typeName": "person", + "schemaName": "public", + "fields": { + "address": { + "fieldName": "address", + "type": { + "compositeType": "person_address" + }, + "description": null + }, + "name": { + "fieldName": "name", + "type": { + "compositeType": "person_name" + }, + "description": null + }, + "age": { + "fieldName": "age", + "type": { + "scalarType": "int4" + }, + "description": null + } + }, + "description": null + }, + "person_address": { + "typeName": "person_address", + "schemaName": "public", + "fields": { + "address_line_1": { + "fieldName": "address_line_1", + "type": { + "scalarType": "text" + }, + "description": null + }, + "address_line_2": { + "fieldName": "address_line_2", + "type": { + "scalarType": "text" + }, + "description": null + } + }, + "description": null + }, + "person_name": { + "typeName": "person_name", + "schemaName": "public", + "fields": { + "first_name": { + "fieldName": "first_name", + "type": { + "scalarType": "text" + }, + "description": null + }, + "last_name": { + "fieldName": "last_name", + "type": { + "scalarType": "text" + }, + "description": null + } + }, + "description": null + } + } + }, + "nativeOperations": { + "queries": {}, + "mutations": {} + } + }, + "introspectionOptions": { + "excludedSchemas": [ + "information_schema", + "pg_catalog", + "tiger", + "crdb_internal", + "columnar", + "columnar_internal" + ], + "unqualifiedSchemasForTables": ["public"], + "unqualifiedSchemasForTypesAndProcedures": [ + "public", + "pg_catalog", + "tiger" + ], + "comparisonOperatorMapping": [ + { + "operatorName": "=", + "exposedName": "_eq", + "operatorKind": "equal" + }, + { + "operatorName": "<=", + "exposedName": "_lte", + "operatorKind": "custom" + }, + { + "operatorName": ">", + "exposedName": "_gt", + "operatorKind": "custom" + }, + { + "operatorName": ">=", + "exposedName": "_gte", + "operatorKind": "custom" + }, + { + "operatorName": "<", + "exposedName": "_lt", + "operatorKind": "custom" + }, + { + "operatorName": "<>", + "exposedName": "_neq", + "operatorKind": "custom" + }, + { + "operatorName": "!=", + "exposedName": "_neq", + "operatorKind": "custom" + }, + { + "operatorName": "LIKE", + "exposedName": "_like", + "operatorKind": "custom" + }, + { + "operatorName": "NOT LIKE", + "exposedName": "_nlike", + "operatorKind": "custom" + }, + { + "operatorName": "ILIKE", + "exposedName": "_ilike", + "operatorKind": "custom" + }, + { + "operatorName": "NOT ILIKE", + "exposedName": "_nilike", + "operatorKind": "custom" + }, + { + "operatorName": "SIMILAR TO", + "exposedName": "_similar", + "operatorKind": "custom" + }, + { + "operatorName": "NOT SIMILAR TO", + "exposedName": "_nsimilar", + "operatorKind": "custom" + }, + { + "operatorName": "~~", + "exposedName": "_like", + "operatorKind": "custom" + }, + { + "operatorName": "!~~", + "exposedName": "_nlike", + "operatorKind": "custom" + }, + { + "operatorName": "~~*", + "exposedName": "_ilike", + "operatorKind": "custom" + }, + { + "operatorName": "!~~*", + "exposedName": "_nilike", + "operatorKind": "custom" + }, + { + "operatorName": "~", + "exposedName": "_regex", + "operatorKind": "custom" + }, + { + "operatorName": "!~", + "exposedName": "_nregex", + "operatorKind": "custom" + }, + { + "operatorName": "~*", + "exposedName": "_iregex", + "operatorKind": "custom" + }, + { + "operatorName": "!~*", + "exposedName": "_niregex", + "operatorKind": "custom" + } + ], + "introspectPrefixFunctionComparisonOperators": [ + "box_above", + "box_below", + "box_contain", + "box_contain_pt", + "box_contained", + "box_left", + "box_overabove", + "box_overbelow", + "box_overlap", + "box_overleft", + "box_overright", + "box_right", + "box_same", + "circle_above", + "circle_below", + "circle_contain", + "circle_contain_pt", + "circle_contained", + "circle_left", + "circle_overabove", + "circle_overbelow", + "circle_overlap", + "circle_overleft", + "circle_overright", + "circle_right", + "circle_same", + "contains_2d", + "equals", + "geography_overlaps", + "geometry_above", + "geometry_below", + "geometry_contained_3d", + "geometry_contains", + "geometry_contains_3d", + "geometry_contains_nd", + "geometry_left", + "geometry_overabove", + "geometry_overbelow", + "geometry_overlaps", + "geometry_overlaps_3d", + "geometry_overlaps_nd", + "geometry_overleft", + "geometry_overright", + "geometry_right", + "geometry_same", + "geometry_same_3d", + "geometry_same_nd", + "geometry_within", + "geometry_within_nd", + "inet_same_family", + "inter_lb", + "inter_sb", + "inter_sl", + "is_contained_2d", + "ishorizontal", + "isparallel", + "isperp", + "isvertical", + "jsonb_contained", + "jsonb_contains", + "jsonb_exists", + "jsonb_path_exists_opr", + "jsonb_path_match_opr", + "line_intersect", + "line_parallel", + "line_perp", + "lseg_intersect", + "lseg_parallel", + "lseg_perp", + "network_overlap", + "network_sub", + "network_sup", + "on_pb", + "on_pl", + "on_ppath", + "on_ps", + "on_sb", + "on_sl", + "overlaps_2d", + "path_contain_pt", + "path_inter", + "point_above", + "point_below", + "point_horiz", + "point_left", + "point_right", + "point_vert", + "poly_above", + "poly_below", + "poly_contain", + "poly_contain_pt", + "poly_contained", + "poly_left", + "poly_overabove", + "poly_overbelow", + "poly_overlap", + "poly_overleft", + "poly_overright", + "poly_right", + "poly_same", + "pt_contained_poly", + "st_3dintersects", + "st_contains", + "st_containsproperly", + "st_coveredby", + "st_covers", + "st_crosses", + "st_disjoint", + "st_equals", + "st_intersects", + "st_isvalid", + "st_orderingequals", + "st_overlaps", + "st_relatematch", + "st_touches", + "st_within", + "starts_with", + "ts_match_qv", + "ts_match_tq", + "ts_match_tt", + "ts_match_vq", + "tsq_mcontained", + "tsq_mcontains", + "xmlexists", + "xmlvalidate", + "xpath_exists" + ], + "typeRepresentations": { + "bit": "string", + "bool": "boolean", + "bpchar": "string", + "char": "string", + "date": "date", + "float4": "float32", + "float8": "float64", + "int2": "int16", + "int4": "int32", + "int8": "int64AsString", + "numeric": "bigDecimalAsString", + "text": "string", + "time": "time", + "timestamp": "timestamp", + "timestamptz": "timestamptz", + "timetz": "timetz", + "uuid": "uUID", + "varchar": "string" + } + }, + "mutationsVersion": null, + "mutationsPrefix": "" +} diff --git a/crates/query-engine/translation/tests/goldenfiles/select_composite_column_nested_field_count/request.json b/crates/query-engine/translation/tests/goldenfiles/select_composite_column_nested_field_count/request.json new file mode 100644 index 000000000..8b1d7c967 --- /dev/null +++ b/crates/query-engine/translation/tests/goldenfiles/select_composite_column_nested_field_count/request.json @@ -0,0 +1,16 @@ +{ + "$schema": "../../../../../../static/query.schema.json", + "collection": "persons", + "query": { + "aggregates": { + "different ages": { + "type": "column_count", + "column": "person", + "field_path": ["age"], + "distinct": true + } + } + }, + "arguments": {}, + "collection_relationships": {} +} diff --git a/crates/query-engine/translation/tests/goldenfiles/select_track_order_by_artist_id_and_album_title/request.json b/crates/query-engine/translation/tests/goldenfiles/select_track_order_by_artist_id_and_album_title/request.json index a43079eec..8c77a605c 100644 --- a/crates/query-engine/translation/tests/goldenfiles/select_track_order_by_artist_id_and_album_title/request.json +++ b/crates/query-engine/translation/tests/goldenfiles/select_track_order_by_artist_id_and_album_title/request.json @@ -61,7 +61,7 @@ "collection_relationships": { "TrackAlbum": { "column_mapping": { - "AlbumId": "AlbumId" + "AlbumId": ["AlbumId"] }, "relationship_type": "object", "target_collection": "Album", diff --git a/crates/query-engine/translation/tests/goldenfiles/select_where_album_id_equals_self_nested_object_relationship/request.json b/crates/query-engine/translation/tests/goldenfiles/select_where_album_id_equals_self_nested_object_relationship/request.json index d83b9cb89..2c389351a 100644 --- a/crates/query-engine/translation/tests/goldenfiles/select_where_album_id_equals_self_nested_object_relationship/request.json +++ b/crates/query-engine/translation/tests/goldenfiles/select_where_album_id_equals_self_nested_object_relationship/request.json @@ -61,88 +61,65 @@ }, "limit": 5, "predicate": { - "type": "binary_comparison_operator", - "column": { - "type": "column", - "name": "AlbumId", - "path": [ + "type": "exists", + "in_collection": { + "type": "related", + "arguments": {}, + "relationship": "TrackToAlbum" + }, + "predicate": { + "type": "and", + "expressions": [ + { + "type": "binary_comparison_operator", + "column": { + "type": "column", + "name": "Title", + "path": [] + }, + "operator": "_eq", + "value": { + "type": "scalar", + "value": "The album title (1)" + } + }, { - "relationship": "TrackToAlbum", - "arguments": {}, - "predicate": { - "type": "and", - "expressions": [ + "type": "binary_comparison_operator", + "column": { + "type": "column", + "name": "AlbumId" + }, + "operator": "_gt", + "value": { + "type": "column", + "name": "ArtistId", + "path": [ { - "type": "binary_comparison_operator", - "column": { - "type": "column", - "name": "Title", - "path": [] - }, - "operator": "_eq", - "value": { - "type": "scalar", - "value": "The album title (1)" + "relationship": "AlbumToArtist", + "arguments": {}, + "predicate": { + "type": "and", + "expressions": [ + { + "type": "binary_comparison_operator", + "column": { + "type": "column", + "name": "Name", + "path": [] + }, + "operator": "_eq", + "value": { + "type": "scalar", + "value": "The Artist name" + } + } + ] } } ] } } ] - }, - "operator": "_gt", - "value": { - "type": "column", - "column": { - "type": "column", - "name": "ArtistId", - "path": [ - { - "relationship": "TrackToAlbum", - "arguments": {}, - "predicate": { - "type": "and", - "expressions": [ - { - "type": "binary_comparison_operator", - "column": { - "type": "column", - "name": "Title", - "path": [] - }, - "operator": "_eq", - "value": { - "type": "scalar", - "value": "The album title (2)" - } - } - ] - } - }, - { - "relationship": "AlbumToArtist", - "arguments": {}, - "predicate": { - "type": "and", - "expressions": [ - { - "type": "binary_comparison_operator", - "column": { - "type": "column", - "name": "Name", - "path": [] - }, - "operator": "_eq", - "value": { - "type": "scalar", - "value": "The Artist name" - } - } - ] - } - } - ] - } } } }, @@ -150,7 +127,7 @@ "collection_relationships": { "TrackToAlbum": { "column_mapping": { - "AlbumId": "AlbumId" + "AlbumId": ["AlbumId"] }, "relationship_type": "object", "target_collection": "Album", @@ -158,7 +135,7 @@ }, "AlbumToArtist": { "column_mapping": { - "ArtistId": "ArtistId" + "ArtistId": ["ArtistId"] }, "relationship_type": "object", "target_collection": "Artist", diff --git a/crates/query-engine/translation/tests/goldenfiles/select_where_array_relationship/request.json b/crates/query-engine/translation/tests/goldenfiles/select_where_array_relationship/request.json index 4b737e0ba..63dfcb334 100644 --- a/crates/query-engine/translation/tests/goldenfiles/select_where_array_relationship/request.json +++ b/crates/query-engine/translation/tests/goldenfiles/select_where_array_relationship/request.json @@ -36,25 +36,23 @@ } }, "predicate": { - "type": "binary_comparison_operator", - "column": { - "type": "column", - "name": "Title", - "path": [ - { - "relationship": "Artist_Albums", - "arguments": {}, - "predicate": { - "type": "and", - "expressions": [] - } - } - ] + "type": "exists", + "in_collection": { + "type": "related", + "relationship": "Artist_Albums", + "arguments": {} }, - "operator": "_like", - "value": { - "type": "scalar", - "value": "Supernatural" + "predicate": { + "type": "binary_comparison_operator", + "column": { + "type": "column", + "name": "Title" + }, + "operator": "_like", + "value": { + "type": "scalar", + "value": "Supernatural" + } } }, "order_by": { @@ -75,7 +73,7 @@ "Artist_Albums": { "arguments": {}, "column_mapping": { - "ArtistId": "ArtistId" + "ArtistId": ["ArtistId"] }, "relationship_type": "array", "target_collection": "Album" diff --git a/crates/query-engine/translation/tests/goldenfiles/select_where_related_exists/request.json b/crates/query-engine/translation/tests/goldenfiles/select_where_related_exists/request.json index 888192006..63587dd84 100644 --- a/crates/query-engine/translation/tests/goldenfiles/select_where_related_exists/request.json +++ b/crates/query-engine/translation/tests/goldenfiles/select_where_related_exists/request.json @@ -50,7 +50,7 @@ "artist_albums": { "arguments": {}, "column_mapping": { - "id": "artist_id" + "id": ["artist_id"] }, "relationship_type": "array", "target_collection": "album" diff --git a/crates/query-engine/translation/tests/goldenfiles/select_where_unrelated_exists/request.json b/crates/query-engine/translation/tests/goldenfiles/select_where_unrelated_exists/request.json index e1c2c67d4..bcfb43199 100644 --- a/crates/query-engine/translation/tests/goldenfiles/select_where_unrelated_exists/request.json +++ b/crates/query-engine/translation/tests/goldenfiles/select_where_unrelated_exists/request.json @@ -35,17 +35,15 @@ { "type": "binary_comparison_operator", "column": { - "type": "root_collection_column", - "name": "artist_id" + "type": "column", + "name": "id" }, "operator": "_eq", "value": { "type": "column", - "column": { - "type": "column", - "name": "id", - "path": [] - } + "name": "artist_id", + "path": [], + "scope": 1 } } ] diff --git a/crates/query-engine/translation/tests/goldenfiles/simple_array_relationship/request.json b/crates/query-engine/translation/tests/goldenfiles/simple_array_relationship/request.json index 862c3ce32..1aad35926 100644 --- a/crates/query-engine/translation/tests/goldenfiles/simple_array_relationship/request.json +++ b/crates/query-engine/translation/tests/goldenfiles/simple_array_relationship/request.json @@ -24,7 +24,7 @@ "collection_relationships": { "Albums": { "column_mapping": { - "ArtistId": "ArtistId" + "ArtistId": ["ArtistId"] }, "relationship_type": "array", "target_collection": "Album", diff --git a/crates/query-engine/translation/tests/goldenfiles/simple_object_relationship/request.json b/crates/query-engine/translation/tests/goldenfiles/simple_object_relationship/request.json index 3951f8930..42b6d8172 100644 --- a/crates/query-engine/translation/tests/goldenfiles/simple_object_relationship/request.json +++ b/crates/query-engine/translation/tests/goldenfiles/simple_object_relationship/request.json @@ -24,7 +24,7 @@ "collection_relationships": { "AlbumArtist": { "column_mapping": { - "ArtistId": "ArtistId" + "ArtistId": ["ArtistId"] }, "relationship_type": "object", "target_collection": "Artist", diff --git a/crates/query-engine/translation/tests/goldenfiles/sorting_by_nested_relationship_column/request.json b/crates/query-engine/translation/tests/goldenfiles/sorting_by_nested_relationship_column/request.json index 3d654d5df..588bac076 100644 --- a/crates/query-engine/translation/tests/goldenfiles/sorting_by_nested_relationship_column/request.json +++ b/crates/query-engine/translation/tests/goldenfiles/sorting_by_nested_relationship_column/request.json @@ -37,7 +37,7 @@ "collection_relationships": { "AlbumArtist": { "column_mapping": { - "artist_id": "artist_id" + "artist_id": ["artist_id"] }, "relationship_type": "object", "target_collection": "artist", @@ -45,7 +45,7 @@ }, "TrackAlbum": { "column_mapping": { - "album_id": "album_id" + "album_id": ["album_id"] }, "relationship_type": "object", "target_collection": "album", diff --git a/crates/query-engine/translation/tests/goldenfiles/sorting_by_nested_relationship_column_with_predicate/request.json b/crates/query-engine/translation/tests/goldenfiles/sorting_by_nested_relationship_column_with_predicate/request.json index f73bbeeb7..6f61d99cf 100644 --- a/crates/query-engine/translation/tests/goldenfiles/sorting_by_nested_relationship_column_with_predicate/request.json +++ b/crates/query-engine/translation/tests/goldenfiles/sorting_by_nested_relationship_column_with_predicate/request.json @@ -55,7 +55,7 @@ "collection_relationships": { "AlbumArtist": { "column_mapping": { - "artist_id": "artist_id" + "artist_id": ["artist_id"] }, "relationship_type": "object", "target_collection": "artist", @@ -63,7 +63,7 @@ }, "TrackAlbum": { "column_mapping": { - "album_id": "album_id" + "album_id": ["album_id"] }, "relationship_type": "object", "target_collection": "album", diff --git a/crates/query-engine/translation/tests/goldenfiles/sorting_by_nested_relationship_count/request.json b/crates/query-engine/translation/tests/goldenfiles/sorting_by_nested_relationship_count/request.json index 06a0a0041..c6bfc529f 100644 --- a/crates/query-engine/translation/tests/goldenfiles/sorting_by_nested_relationship_count/request.json +++ b/crates/query-engine/translation/tests/goldenfiles/sorting_by_nested_relationship_count/request.json @@ -13,16 +13,19 @@ "elements": [ { "target": { - "type": "single_column_aggregate", - "column": "AlbumId", - "function": "count", + "type": "aggregate", "path": [ { "relationship": "ArtistAlbum", "arguments": {}, "predicate": null } - ] + ], + "aggregate": { + "type": "single_column", + "column": "AlbumId", + "function": "count" + } }, "order_direction": "desc" } @@ -34,7 +37,7 @@ "collection_relationships": { "ArtistAlbum": { "column_mapping": { - "ArtistId": "ArtistId" + "ArtistId": ["ArtistId"] }, "relationship_type": "array", "target_collection": "Album", diff --git a/crates/query-engine/translation/tests/goldenfiles/sorting_by_no_relationship_aggregate/request.json b/crates/query-engine/translation/tests/goldenfiles/sorting_by_no_relationship_aggregate/request.json index 1570c39a9..33c95a642 100644 --- a/crates/query-engine/translation/tests/goldenfiles/sorting_by_no_relationship_aggregate/request.json +++ b/crates/query-engine/translation/tests/goldenfiles/sorting_by_no_relationship_aggregate/request.json @@ -13,10 +13,13 @@ "elements": [ { "target": { - "type": "single_column_aggregate", - "column": "TopRadioChartPlacement", - "function": "impossible", - "path": [] + "type": "aggregate", + "path": [], + "aggregate": { + "type": "single_column", + "column": "TopRadioChartPlacement", + "function": "impossible" + } }, "order_direction": "desc" } diff --git a/crates/query-engine/translation/tests/goldenfiles/sorting_by_recursive_relationship_column/request.json b/crates/query-engine/translation/tests/goldenfiles/sorting_by_recursive_relationship_column/request.json index 7bd6c9733..d6a9b7180 100644 --- a/crates/query-engine/translation/tests/goldenfiles/sorting_by_recursive_relationship_column/request.json +++ b/crates/query-engine/translation/tests/goldenfiles/sorting_by_recursive_relationship_column/request.json @@ -37,7 +37,7 @@ "collection_relationships": { "CompanyCEO": { "column_mapping": { - "CEOId": "PersonId" + "CEOId": ["PersonId"] }, "relationship_type": "object", "target_collection": "Person", @@ -45,7 +45,7 @@ }, "PersonParent": { "column_mapping": { - "ParentId": "PersonId" + "ParentId": ["PersonId"] }, "relationship_type": "object", "target_collection": "Person", diff --git a/crates/query-engine/translation/tests/goldenfiles/sorting_by_relationship_column/request.json b/crates/query-engine/translation/tests/goldenfiles/sorting_by_relationship_column/request.json index 8d2712a92..a09fda8e8 100644 --- a/crates/query-engine/translation/tests/goldenfiles/sorting_by_relationship_column/request.json +++ b/crates/query-engine/translation/tests/goldenfiles/sorting_by_relationship_column/request.json @@ -34,7 +34,7 @@ "collection_relationships": { "AlbumArtist": { "column_mapping": { - "ArtistId": "ArtistId" + "ArtistId": ["ArtistId"] }, "relationship_type": "object", "target_collection": "Artist", diff --git a/crates/query-engine/translation/tests/goldenfiles/sorting_by_relationship_column_with_true_predicate/request.json b/crates/query-engine/translation/tests/goldenfiles/sorting_by_relationship_column_with_true_predicate/request.json index b8f4b5e56..4c6b0dd13 100644 --- a/crates/query-engine/translation/tests/goldenfiles/sorting_by_relationship_column_with_true_predicate/request.json +++ b/crates/query-engine/translation/tests/goldenfiles/sorting_by_relationship_column_with_true_predicate/request.json @@ -37,7 +37,7 @@ "collection_relationships": { "AlbumArtist": { "column_mapping": { - "ArtistId": "ArtistId" + "ArtistId": ["ArtistId"] }, "relationship_type": "object", "target_collection": "Artist", diff --git a/crates/query-engine/translation/tests/goldenfiles/sorting_by_relationship_count/request.json b/crates/query-engine/translation/tests/goldenfiles/sorting_by_relationship_count/request.json index 01d84bc3e..a273bc5b7 100644 --- a/crates/query-engine/translation/tests/goldenfiles/sorting_by_relationship_count/request.json +++ b/crates/query-engine/translation/tests/goldenfiles/sorting_by_relationship_count/request.json @@ -15,14 +15,17 @@ { "order_direction": "desc", "target": { - "type": "star_count_aggregate", + "type": "aggregate", "path": [ { "relationship": "ArtistAlbums", "arguments": {}, "predicate": null } - ] + ], + "aggregate": { + "type": "star_count" + } } } ] @@ -32,7 +35,7 @@ "collection_relationships": { "ArtistAlbums": { "column_mapping": { - "ArtistId": "ArtistId" + "ArtistId": ["ArtistId"] }, "relationship_type": "array", "target_collection": "Album", diff --git a/crates/query-engine/translation/tests/goldenfiles/sorting_by_relationship_count_with_predicate/request.json b/crates/query-engine/translation/tests/goldenfiles/sorting_by_relationship_count_with_predicate/request.json index 18dc787af..766bb1cd0 100644 --- a/crates/query-engine/translation/tests/goldenfiles/sorting_by_relationship_count_with_predicate/request.json +++ b/crates/query-engine/translation/tests/goldenfiles/sorting_by_relationship_count_with_predicate/request.json @@ -15,7 +15,7 @@ { "order_direction": "desc", "target": { - "type": "star_count_aggregate", + "type": "aggregate", "path": [ { "relationship": "ArtistAlbums", @@ -47,7 +47,10 @@ ] } } - ] + ], + "aggregate": { + "type": "star_count" + } } }, { @@ -65,7 +68,7 @@ "collection_relationships": { "ArtistAlbums": { "column_mapping": { - "ArtistId": "ArtistId" + "ArtistId": ["ArtistId"] }, "relationship_type": "array", "target_collection": "Album", @@ -73,7 +76,7 @@ }, "AlbumTracks": { "column_mapping": { - "AlbumId": "album_id" + "AlbumId": ["album_id"] }, "relationship_type": "array", "target_collection": "track", diff --git a/crates/query-engine/translation/tests/goldenfiles/very_nested_recursive_relationship/request.json b/crates/query-engine/translation/tests/goldenfiles/very_nested_recursive_relationship/request.json index 56ab79045..caaf2a1d2 100644 --- a/crates/query-engine/translation/tests/goldenfiles/very_nested_recursive_relationship/request.json +++ b/crates/query-engine/translation/tests/goldenfiles/very_nested_recursive_relationship/request.json @@ -56,7 +56,7 @@ "collection_relationships": { "ArtistAlbums": { "column_mapping": { - "ArtistId": "ArtistId" + "ArtistId": ["ArtistId"] }, "relationship_type": "array", "target_collection": "Album", @@ -64,7 +64,7 @@ }, "AlbumArtist": { "column_mapping": { - "ArtistId": "ArtistId" + "ArtistId": ["ArtistId"] }, "relationship_type": "object", "target_collection": "Artist", diff --git a/crates/query-engine/translation/tests/snapshots/tests__aggregate_limit_offset_order_by.snap b/crates/query-engine/translation/tests/snapshots/tests__aggregate_limit_offset_order_by.snap index 4be4591b6..f5921fec0 100644 --- a/crates/query-engine/translation/tests/snapshots/tests__aggregate_limit_offset_order_by.snap +++ b/crates/query-engine/translation/tests/snapshots/tests__aggregate_limit_offset_order_by.snap @@ -1,6 +1,7 @@ --- source: crates/query-engine/translation/tests/tests.rs expression: result +snapshot_kind: text --- SELECT coalesce(json_agg(row_to_json("%3_universe")), '[]') AS "universe" @@ -23,7 +24,7 @@ FROM COUNT("%2_Invoice"."InvoiceId") AS "InvoiceId_count", min("%2_Invoice"."Total") AS "Total__min", max("%2_Invoice"."Total") AS "Total__max", - sum("%2_Invoice"."Total") AS "Total__sum", + coalesce(sum("%2_Invoice"."Total"), 0) AS "Total__sum", stddev("%2_Invoice"."Total") AS "Total__stddev", COUNT(*) AS "count_all" FROM diff --git a/crates/query-engine/translation/tests/snapshots/tests__it_select_where_unrelated_exists.snap b/crates/query-engine/translation/tests/snapshots/tests__it_select_where_unrelated_exists.snap index c82c9d5e7..cc00a33ce 100644 --- a/crates/query-engine/translation/tests/snapshots/tests__it_select_where_unrelated_exists.snap +++ b/crates/query-engine/translation/tests/snapshots/tests__it_select_where_unrelated_exists.snap @@ -1,6 +1,7 @@ --- source: crates/query-engine/translation/tests/tests.rs expression: result +snapshot_kind: text --- SELECT coalesce(json_agg(row_to_json("%2_universe")), '[]') AS "universe" @@ -29,7 +30,7 @@ FROM ( "%1_artist"."Name" = cast($1 as "pg_catalog"."varchar") ) - AND ("%0_album"."ArtistId" = "%1_artist"."ArtistId") + AND ("%1_artist"."ArtistId" = "%0_album"."ArtistId") ) ) ) AS "%3_rows" diff --git a/crates/query-engine/translation/tests/snapshots/tests__select_composite_column_nested_field_count.snap b/crates/query-engine/translation/tests/snapshots/tests__select_composite_column_nested_field_count.snap new file mode 100644 index 000000000..16d66bf98 --- /dev/null +++ b/crates/query-engine/translation/tests/snapshots/tests__select_composite_column_nested_field_count.snap @@ -0,0 +1,32 @@ +--- +source: crates/query-engine/translation/tests/tests.rs +assertion_line: 62 +expression: result +snapshot_kind: text +--- +SELECT + coalesce(json_agg(row_to_json("%3_universe")), '[]') AS "universe" +FROM + ( + SELECT + * + FROM + ( + SELECT + coalesce(row_to_json("%5_aggregates"), '[]') AS "aggregates" + FROM + ( + SELECT + COUNT(DISTINCT ("%2_persons"."person")."age") AS "different ages" + FROM + ( + SELECT + "%1_persons".* + FROM + "public"."persons" AS "%1_persons" + ) AS "%2_persons" + ) AS "%5_aggregates" + ) AS "%5_aggregates" + ) AS "%3_universe"; + +{} diff --git a/crates/query-engine/translation/tests/snapshots/tests__select_where_album_id_equals_self_nested_object_relationship.snap b/crates/query-engine/translation/tests/snapshots/tests__select_where_album_id_equals_self_nested_object_relationship.snap index e6266fd7a..bf7b2f760 100644 --- a/crates/query-engine/translation/tests/snapshots/tests__select_where_album_id_equals_self_nested_object_relationship.snap +++ b/crates/query-engine/translation/tests/snapshots/tests__select_where_album_id_equals_self_nested_object_relationship.snap @@ -3,7 +3,7 @@ source: crates/query-engine/translation/tests/tests.rs expression: result --- SELECT - coalesce(json_agg(row_to_json("%14_universe")), '[]') AS "universe" + coalesce(json_agg(row_to_json("%12_universe")), '[]') AS "universe" FROM ( SELECT @@ -11,7 +11,7 @@ FROM FROM ( SELECT - coalesce(json_agg(row_to_json("%15_rows")), '[]') AS "rows" + coalesce(json_agg(row_to_json("%13_rows")), '[]') AS "rows" FROM ( SELECT @@ -30,17 +30,17 @@ FROM FROM ( SELECT - coalesce(json_agg(row_to_json("%12_rows")), '[]') AS "rows" + coalesce(json_agg(row_to_json("%10_rows")), '[]') AS "rows" FROM ( SELECT - "%7_Album"."Title" AS "album", - "%8_RELATIONSHIP_Artist"."Artist" AS "Artist" + "%5_Album"."Title" AS "album", + "%6_RELATIONSHIP_Artist"."Artist" AS "Artist" FROM - "public"."Album" AS "%7_Album" + "public"."Album" AS "%5_Album" LEFT OUTER JOIN LATERAL ( SELECT - row_to_json("%8_RELATIONSHIP_Artist") AS "Artist" + row_to_json("%6_RELATIONSHIP_Artist") AS "Artist" FROM ( SELECT @@ -48,107 +48,78 @@ FROM FROM ( SELECT - coalesce(json_agg(row_to_json("%10_rows")), '[]') AS "rows" + coalesce(json_agg(row_to_json("%8_rows")), '[]') AS "rows" FROM ( SELECT - "%9_Artist"."Name" AS "artist", - "%9_Artist"."ArtistId" AS "ArtistId" + "%7_Artist"."Name" AS "artist", + "%7_Artist"."ArtistId" AS "ArtistId" FROM - "public"."Artist" AS "%9_Artist" + "public"."Artist" AS "%7_Artist" WHERE - ("%7_Album"."ArtistId" = "%9_Artist"."ArtistId") - ) AS "%10_rows" - ) AS "%10_rows" - ) AS "%8_RELATIONSHIP_Artist" - ) AS "%8_RELATIONSHIP_Artist" ON ('true') + ("%5_Album"."ArtistId" = "%7_Artist"."ArtistId") + ) AS "%8_rows" + ) AS "%8_rows" + ) AS "%6_RELATIONSHIP_Artist" + ) AS "%6_RELATIONSHIP_Artist" ON ('true') WHERE - ("%0_Track"."AlbumId" = "%7_Album"."AlbumId") - ) AS "%12_rows" - ) AS "%12_rows" + ("%0_Track"."AlbumId" = "%5_Album"."AlbumId") + ) AS "%10_rows" + ) AS "%10_rows" ) AS "%1_RELATIONSHIP_Album" ) AS "%1_RELATIONSHIP_Album" ON ('true') WHERE EXISTS ( SELECT - 1 + 1 AS "one" FROM - ( - SELECT - "%2_BOOLEXP_Album".* - FROM - ( - SELECT - * - FROM - "public"."Album" AS "%2_BOOLEXP_Album" - WHERE - ( - ( - "%2_BOOLEXP_Album"."Title" = cast($1 as "pg_catalog"."varchar") - ) - AND ( - "%0_Track"."AlbumId" = "%2_BOOLEXP_Album"."AlbumId" - ) - ) - ) AS "%2_BOOLEXP_Album" - ) AS "%3_BOOLEXP_Album" FULL + "public"."Album" AS "%2_Album" FULL OUTER JOIN LATERAL ( SELECT - "%5_BOOLEXP_Artist".* + "%3_BOOLEXP_Artist".* FROM ( SELECT * FROM - "public"."Album" AS "%4_BOOLEXP_Album" - WHERE - ( - ( - "%4_BOOLEXP_Album"."Title" = cast($2 as "pg_catalog"."varchar") - ) - AND ( - "%0_Track"."AlbumId" = "%4_BOOLEXP_Album"."AlbumId" - ) - ) - ) AS "%4_BOOLEXP_Album" - INNER JOIN LATERAL ( - SELECT - * - FROM - "public"."Artist" AS "%5_BOOLEXP_Artist" + "public"."Artist" AS "%3_BOOLEXP_Artist" WHERE ( ( - "%5_BOOLEXP_Artist"."Name" = cast($3 as "pg_catalog"."varchar") + "%3_BOOLEXP_Artist"."Name" = cast($1 as "pg_catalog"."varchar") ) AND ( - "%4_BOOLEXP_Album"."ArtistId" = "%5_BOOLEXP_Artist"."ArtistId" + "%2_Album"."ArtistId" = "%3_BOOLEXP_Artist"."ArtistId" ) ) - ) AS "%5_BOOLEXP_Artist" ON ('true') - ) AS "%6_BOOLEXP_Artist" ON ('true') + ) AS "%3_BOOLEXP_Artist" + ) AS "%4_BOOLEXP_Artist" ON ('true') WHERE ( - "%3_BOOLEXP_Album"."AlbumId" > "%6_BOOLEXP_Artist"."ArtistId" + ( + ( + "%2_Album"."Title" = cast($2 as "pg_catalog"."varchar") + ) + AND ( + "%2_Album"."AlbumId" > "%4_BOOLEXP_Artist"."ArtistId" + ) + ) + AND ("%0_Track"."AlbumId" = "%2_Album"."AlbumId") ) ) ORDER BY "%0_Track"."TrackId" ASC LIMIT 5 - ) AS "%15_rows" - ) AS "%15_rows" - ) AS "%14_universe"; + ) AS "%13_rows" + ) AS "%13_rows" + ) AS "%12_universe"; { 1: String( - "The album title (1)", + "The Artist name", ), 2: String( - "The album title (2)", - ), - 3: String( - "The Artist name", + "The album title (1)", ), } diff --git a/crates/query-engine/translation/tests/snapshots/tests__select_where_array_relationship.snap b/crates/query-engine/translation/tests/snapshots/tests__select_where_array_relationship.snap index d9cd86f6c..70a6cdc51 100644 --- a/crates/query-engine/translation/tests/snapshots/tests__select_where_array_relationship.snap +++ b/crates/query-engine/translation/tests/snapshots/tests__select_where_array_relationship.snap @@ -3,7 +3,7 @@ source: crates/query-engine/translation/tests/tests.rs expression: result --- SELECT - coalesce(json_agg(row_to_json("%7_universe")), '[]') AS "universe" + coalesce(json_agg(row_to_json("%6_universe")), '[]') AS "universe" FROM ( SELECT @@ -11,7 +11,7 @@ FROM FROM ( SELECT - coalesce(json_agg(row_to_json("%8_rows")), '[]') AS "rows" + coalesce(json_agg(row_to_json("%7_rows")), '[]') AS "rows" FROM ( SELECT @@ -29,51 +29,40 @@ FROM FROM ( SELECT - coalesce(json_agg(row_to_json("%5_rows")), '[]') AS "rows" + coalesce(json_agg(row_to_json("%4_rows")), '[]') AS "rows" FROM ( SELECT - "%4_Album"."Title" AS "title" + "%3_Album"."Title" AS "title" FROM - "public"."Album" AS "%4_Album" + "public"."Album" AS "%3_Album" WHERE - ("%0_Artist"."ArtistId" = "%4_Album"."ArtistId") + ("%0_Artist"."ArtistId" = "%3_Album"."ArtistId") ORDER BY - "%4_Album"."AlbumId" ASC - ) AS "%5_rows" - ) AS "%5_rows" + "%3_Album"."AlbumId" ASC + ) AS "%4_rows" + ) AS "%4_rows" ) AS "%1_RELATIONSHIP_albums" ) AS "%1_RELATIONSHIP_albums" ON ('true') WHERE EXISTS ( SELECT - 1 + 1 AS "one" FROM - ( - SELECT - "%2_BOOLEXP_Album".* - FROM - ( - SELECT - * - FROM - "public"."Album" AS "%2_BOOLEXP_Album" - WHERE - ( - "%0_Artist"."ArtistId" = "%2_BOOLEXP_Album"."ArtistId" - ) - ) AS "%2_BOOLEXP_Album" - ) AS "%3_BOOLEXP_Album" + "public"."Album" AS "%2_Album" WHERE ( - "%3_BOOLEXP_Album"."Title" LIKE cast($1 as "pg_catalog"."varchar") + ( + "%2_Album"."Title" LIKE cast($1 as "pg_catalog"."varchar") + ) + AND ("%0_Artist"."ArtistId" = "%2_Album"."ArtistId") ) ) ORDER BY "%0_Artist"."ArtistId" ASC - ) AS "%8_rows" - ) AS "%8_rows" - ) AS "%7_universe"; + ) AS "%7_rows" + ) AS "%7_rows" + ) AS "%6_universe"; { 1: String( diff --git a/crates/query-engine/translation/tests/tests.rs b/crates/query-engine/translation/tests/tests.rs index 8d8ae3ff1..3061197e4 100644 --- a/crates/query-engine/translation/tests/tests.rs +++ b/crates/query-engine/translation/tests/tests.rs @@ -54,6 +54,14 @@ async fn select_composite_column_complex() { insta::assert_snapshot!(result); } +#[tokio::test] +async fn select_composite_column_nested_field_count() { + let result = common::test_translation("select_composite_column_nested_field_count") + .await + .unwrap(); + insta::assert_snapshot!(result); +} + #[tokio::test] async fn select_composite_variable_simple() { let result = common::test_translation("select_composite_variable_simple") diff --git a/crates/tests/databases-tests/src/citus/snapshots/databases_tests__citus__schema_tests__schema_test__get_schema.snap b/crates/tests/databases-tests/src/citus/snapshots/databases_tests__citus__schema_tests__schema_test__get_schema.snap index 0ba1d78b5..792dbe602 100644 --- a/crates/tests/databases-tests/src/citus/snapshots/databases_tests__citus__schema_tests__schema_test__get_schema.snap +++ b/crates/tests/databases-tests/src/citus/snapshots/databases_tests__citus__schema_tests__schema_test__get_schema.snap @@ -1,6 +1,7 @@ --- source: crates/tests/databases-tests/src/citus/schema_tests.rs expression: result +snapshot_kind: text --- { "scalar_types": { @@ -10,22 +11,10 @@ expression: result }, "aggregate_functions": { "max": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "text" - } - } + "type": "max" }, "min": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "text" - } - } + "type": "min" } }, "comparison_operators": { @@ -148,6 +137,7 @@ expression: result }, "aggregate_functions": { "bool_and": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -157,6 +147,7 @@ expression: result } }, "bool_or": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -166,6 +157,7 @@ expression: result } }, "every": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -231,22 +223,10 @@ expression: result }, "aggregate_functions": { "max": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "card_suit" - } - } + "type": "max" }, "min": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "card_suit" - } - } + "type": "min" } }, "comparison_operators": { @@ -299,22 +279,10 @@ expression: result }, "aggregate_functions": { "max": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "text" - } - } + "type": "max" }, "min": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "text" - } - } + "type": "min" } }, "comparison_operators": { @@ -437,22 +405,10 @@ expression: result }, "aggregate_functions": { "max": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "date" - } - } + "type": "max" }, "min": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "date" - } - } + "type": "min" } }, "comparison_operators": { @@ -505,6 +461,7 @@ expression: result }, "aggregate_functions": { "avg": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -514,6 +471,7 @@ expression: result } }, "bit_and": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -523,6 +481,7 @@ expression: result } }, "bit_or": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -532,6 +491,7 @@ expression: result } }, "bit_xor": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -541,24 +501,13 @@ expression: result } }, "max": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "int4" - } - } + "type": "max" }, "min": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "int4" - } - } + "type": "min" }, "stddev": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -568,6 +517,7 @@ expression: result } }, "stddev_pop": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -577,6 +527,7 @@ expression: result } }, "stddev_samp": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -586,15 +537,11 @@ expression: result } }, "sum": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "int8" - } - } + "type": "sum", + "result_type": "int8" }, "var_pop": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -604,6 +551,7 @@ expression: result } }, "var_samp": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -613,6 +561,7 @@ expression: result } }, "variance": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -672,33 +621,17 @@ expression: result }, "aggregate_functions": { "avg": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "float8" - } - } + "type": "average", + "result_type": "float8" }, "max": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "float4" - } - } + "type": "max" }, "min": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "float4" - } - } + "type": "min" }, "stddev": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -708,6 +641,7 @@ expression: result } }, "stddev_pop": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -717,6 +651,7 @@ expression: result } }, "stddev_samp": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -726,6 +661,7 @@ expression: result } }, "sum": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -735,6 +671,7 @@ expression: result } }, "var_pop": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -744,6 +681,7 @@ expression: result } }, "var_samp": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -753,6 +691,7 @@ expression: result } }, "variance": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -812,33 +751,17 @@ expression: result }, "aggregate_functions": { "avg": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "float8" - } - } + "type": "average", + "result_type": "float8" }, "max": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "float8" - } - } + "type": "max" }, "min": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "float8" - } - } + "type": "min" }, "stddev": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -848,6 +771,7 @@ expression: result } }, "stddev_pop": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -857,6 +781,7 @@ expression: result } }, "stddev_samp": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -866,15 +791,11 @@ expression: result } }, "sum": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "float8" - } - } + "type": "sum", + "result_type": "float8" }, "var_pop": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -884,6 +805,7 @@ expression: result } }, "var_samp": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -893,6 +815,7 @@ expression: result } }, "variance": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -952,6 +875,7 @@ expression: result }, "aggregate_functions": { "avg": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -961,6 +885,7 @@ expression: result } }, "bit_and": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -970,6 +895,7 @@ expression: result } }, "bit_or": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -979,6 +905,7 @@ expression: result } }, "bit_xor": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -988,24 +915,13 @@ expression: result } }, "max": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "int2" - } - } + "type": "max" }, "min": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "int2" - } - } + "type": "min" }, "stddev": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1015,6 +931,7 @@ expression: result } }, "stddev_pop": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1024,6 +941,7 @@ expression: result } }, "stddev_samp": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1033,15 +951,11 @@ expression: result } }, "sum": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "int8" - } - } + "type": "sum", + "result_type": "int8" }, "var_pop": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1051,6 +965,7 @@ expression: result } }, "var_samp": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1060,6 +975,7 @@ expression: result } }, "variance": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1119,6 +1035,7 @@ expression: result }, "aggregate_functions": { "avg": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1128,6 +1045,7 @@ expression: result } }, "bit_and": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1137,6 +1055,7 @@ expression: result } }, "bit_or": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1146,6 +1065,7 @@ expression: result } }, "bit_xor": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1155,24 +1075,13 @@ expression: result } }, "max": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "int4" - } - } + "type": "max" }, "min": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "int4" - } - } + "type": "min" }, "stddev": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1182,6 +1091,7 @@ expression: result } }, "stddev_pop": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1191,6 +1101,7 @@ expression: result } }, "stddev_samp": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1200,15 +1111,11 @@ expression: result } }, "sum": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "int8" - } - } + "type": "sum", + "result_type": "int8" }, "var_pop": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1218,6 +1125,7 @@ expression: result } }, "var_samp": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1227,6 +1135,7 @@ expression: result } }, "variance": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1286,6 +1195,7 @@ expression: result }, "aggregate_functions": { "avg": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1295,6 +1205,7 @@ expression: result } }, "bit_and": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1304,6 +1215,7 @@ expression: result } }, "bit_or": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1313,6 +1225,7 @@ expression: result } }, "bit_xor": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1322,24 +1235,13 @@ expression: result } }, "max": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "int8" - } - } + "type": "max" }, "min": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "int8" - } - } + "type": "min" }, "stddev": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1349,6 +1251,7 @@ expression: result } }, "stddev_pop": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1358,6 +1261,7 @@ expression: result } }, "stddev_samp": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1367,6 +1271,7 @@ expression: result } }, "sum": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1376,6 +1281,7 @@ expression: result } }, "var_pop": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1385,6 +1291,7 @@ expression: result } }, "var_samp": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1394,6 +1301,7 @@ expression: result } }, "variance": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1448,8 +1356,12 @@ expression: result } }, "interval": { + "representation": { + "type": "json" + }, "aggregate_functions": { "avg": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1459,24 +1371,13 @@ expression: result } }, "max": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "interval" - } - } + "type": "max" }, "min": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "interval" - } - } + "type": "min" }, "sum": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1536,6 +1437,7 @@ expression: result }, "aggregate_functions": { "avg": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1545,24 +1447,13 @@ expression: result } }, "max": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "numeric" - } - } + "type": "max" }, "min": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "numeric" - } - } + "type": "min" }, "stddev": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1572,6 +1463,7 @@ expression: result } }, "stddev_pop": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1581,6 +1473,7 @@ expression: result } }, "stddev_samp": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1590,6 +1483,7 @@ expression: result } }, "sum": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1599,6 +1493,7 @@ expression: result } }, "var_pop": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1608,6 +1503,7 @@ expression: result } }, "var_samp": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1617,6 +1513,7 @@ expression: result } }, "variance": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1676,22 +1573,10 @@ expression: result }, "aggregate_functions": { "max": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "text" - } - } + "type": "max" }, "min": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "text" - } - } + "type": "min" } }, "comparison_operators": { @@ -1814,6 +1699,7 @@ expression: result }, "aggregate_functions": { "avg": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1823,24 +1709,13 @@ expression: result } }, "max": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "time" - } - } + "type": "max" }, "min": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "time" - } - } + "type": "min" }, "sum": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1900,22 +1775,10 @@ expression: result }, "aggregate_functions": { "max": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "timestamp" - } - } + "type": "max" }, "min": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "timestamp" - } - } + "type": "min" } }, "comparison_operators": { @@ -1968,22 +1831,10 @@ expression: result }, "aggregate_functions": { "max": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "timestamptz" - } - } + "type": "max" }, "min": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "timestamptz" - } - } + "type": "min" } }, "comparison_operators": { @@ -2036,22 +1887,10 @@ expression: result }, "aggregate_functions": { "max": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "timetz" - } - } + "type": "max" }, "min": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "timetz" - } - } + "type": "min" } }, "comparison_operators": { @@ -2153,22 +1992,10 @@ expression: result }, "aggregate_functions": { "max": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "text" - } - } + "type": "max" }, "min": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "text" - } - } + "type": "min" } }, "comparison_operators": { @@ -2311,6 +2138,16 @@ expression: result "name": "varchar" } } + }, + "foreign_keys": { + "FK_AlbumArtistId": { + "column_mapping": { + "ArtistId": [ + "ArtistId" + ] + }, + "foreign_collection": "Artist" + } } }, "Artist": { @@ -2333,7 +2170,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "Customer": { "description": "The record of all customers", @@ -2446,6 +2284,16 @@ expression: result } } } + }, + "foreign_keys": { + "FK_CustomerSupportRepId": { + "column_mapping": { + "SupportRepId": [ + "EmployeeId" + ] + }, + "foreign_collection": "Employee" + } } }, "Employee": { @@ -2576,6 +2424,16 @@ expression: result } } } + }, + "foreign_keys": { + "FK_EmployeeReportsTo": { + "column_mapping": { + "ReportsTo": [ + "EmployeeId" + ] + }, + "foreign_collection": "Employee" + } } }, "Genre": { @@ -2595,7 +2453,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "Invoice": { "fields": { @@ -2668,6 +2527,16 @@ expression: result "name": "numeric" } } + }, + "foreign_keys": { + "FK_InvoiceCustomerId": { + "column_mapping": { + "CustomerId": [ + "CustomerId" + ] + }, + "foreign_collection": "Customer" + } } }, "InvoiceLine": { @@ -2702,6 +2571,24 @@ expression: result "name": "numeric" } } + }, + "foreign_keys": { + "FK_InvoiceLineInvoiceId": { + "column_mapping": { + "InvoiceId": [ + "InvoiceId" + ] + }, + "foreign_collection": "Invoice" + }, + "FK_InvoiceLineTrackId": { + "column_mapping": { + "TrackId": [ + "TrackId" + ] + }, + "foreign_collection": "Track" + } } }, "MediaType": { @@ -2721,7 +2608,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "Playlist": { "fields": { @@ -2740,7 +2628,8 @@ expression: result "name": "int4" } } - } + }, + "foreign_keys": {} }, "PlaylistTrack": { "fields": { @@ -2756,6 +2645,24 @@ expression: result "name": "int4" } } + }, + "foreign_keys": { + "FK_PlaylistTrackPlaylistId": { + "column_mapping": { + "PlaylistId": [ + "PlaylistId" + ] + }, + "foreign_collection": "Playlist" + }, + "FK_PlaylistTrackTrackId": { + "column_mapping": { + "TrackId": [ + "TrackId" + ] + }, + "foreign_collection": "Track" + } } }, "Track": { @@ -2826,6 +2733,32 @@ expression: result "name": "numeric" } } + }, + "foreign_keys": { + "FK_TrackAlbumId": { + "column_mapping": { + "AlbumId": [ + "AlbumId" + ] + }, + "foreign_collection": "Album" + }, + "FK_TrackGenreId": { + "column_mapping": { + "GenreId": [ + "GenreId" + ] + }, + "foreign_collection": "Genre" + }, + "FK_TrackMediaTypeId": { + "column_mapping": { + "MediaTypeId": [ + "MediaTypeId" + ] + }, + "foreign_collection": "MediaType" + } } }, "address_identity_function": { @@ -2840,7 +2773,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "album_by_title": { "fields": { @@ -2871,7 +2805,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "array_reverse": { "description": "A native query used to test support for arrays as inputs", @@ -2892,7 +2827,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "array_series": { "description": "A native query used to test support for arrays", @@ -2921,7 +2857,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "artist": { "fields": { @@ -2943,7 +2880,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "artist_below_id": { "fields": { @@ -2965,7 +2903,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "chara": { "fields": { @@ -2987,7 +2926,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "characters": { "fields": { @@ -3015,7 +2955,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "committee": { "fields": { @@ -3043,7 +2984,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "count_elements": { "description": "A native query used to test support array-valued variables", @@ -3057,7 +2999,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "deck_of_cards": { "fields": { @@ -3073,7 +3016,8 @@ expression: result "name": "card_suit" } } - } + }, + "foreign_keys": {} }, "delete_playlist_track": { "fields": { @@ -3095,7 +3039,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "delete_playlist_track_response": { "description": "Responses from the 'delete_playlist_track' procedure", @@ -3117,7 +3062,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "discoverable_types": { "fields": { @@ -3130,7 +3076,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "discoverable_types_root_occurrence": { "fields": { @@ -3143,7 +3090,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "even_numbers": { "fields": { @@ -3153,7 +3101,8 @@ expression: result "name": "even_number" } } - } + }, + "foreign_keys": {} }, "group_leader": { "fields": { @@ -3184,7 +3133,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "insert_album": { "fields": { @@ -3215,7 +3165,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "insert_album_response": { "description": "Responses from the 'insert_album' procedure", @@ -3237,7 +3188,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "insert_artist": { "fields": { @@ -3259,7 +3211,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "insert_artist_response": { "description": "Responses from the 'insert_artist' procedure", @@ -3281,7 +3234,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "make_person": { "description": "A native query used to test support for composite types", @@ -3295,7 +3249,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "organization": { "fields": { @@ -3323,7 +3278,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "organization_identity_function": { "description": "A native query used to test support for composite types", @@ -3337,7 +3293,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "person": { "fields": { @@ -3359,7 +3316,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "person_address": { "description": "The address of a person, obviously", @@ -3384,7 +3342,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "person_name": { "description": "The name of a person, obviously", @@ -3409,7 +3368,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "phone_numbers": { "fields": { @@ -3419,7 +3379,8 @@ expression: result "name": "Phone" } } - } + }, + "foreign_keys": {} }, "summarize_organizations": { "description": "A native query used to test support array-valued variables", @@ -3433,7 +3394,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_delete_Album_by_AlbumId_response": { "description": "Responses from the 'v1_delete_Album_by_AlbumId' procedure", @@ -3455,7 +3417,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_delete_Artist_by_ArtistId_response": { "description": "Responses from the 'v1_delete_Artist_by_ArtistId' procedure", @@ -3477,7 +3440,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_delete_Customer_by_CustomerId_response": { "description": "Responses from the 'v1_delete_Customer_by_CustomerId' procedure", @@ -3499,7 +3463,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_delete_Employee_by_EmployeeId_response": { "description": "Responses from the 'v1_delete_Employee_by_EmployeeId' procedure", @@ -3521,7 +3486,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_delete_Genre_by_GenreId_response": { "description": "Responses from the 'v1_delete_Genre_by_GenreId' procedure", @@ -3543,7 +3509,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_delete_InvoiceLine_by_InvoiceLineId_response": { "description": "Responses from the 'v1_delete_InvoiceLine_by_InvoiceLineId' procedure", @@ -3565,7 +3532,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_delete_Invoice_by_InvoiceId_response": { "description": "Responses from the 'v1_delete_Invoice_by_InvoiceId' procedure", @@ -3587,7 +3555,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_delete_MediaType_by_MediaTypeId_response": { "description": "Responses from the 'v1_delete_MediaType_by_MediaTypeId' procedure", @@ -3609,7 +3578,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_delete_Playlist_by_PlaylistId_response": { "description": "Responses from the 'v1_delete_Playlist_by_PlaylistId' procedure", @@ -3631,7 +3601,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_delete_Track_by_TrackId_response": { "description": "Responses from the 'v1_delete_Track_by_TrackId' procedure", @@ -3653,7 +3624,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_insert_Album_object": { "fields": { @@ -3678,7 +3650,8 @@ expression: result "name": "varchar" } } - } + }, + "foreign_keys": {} }, "v1_insert_Album_response": { "description": "Responses from the 'v1_insert_Album' procedure", @@ -3700,7 +3673,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_insert_Artist_object": { "fields": { @@ -3721,7 +3695,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_insert_Artist_response": { "description": "Responses from the 'v1_insert_Artist' procedure", @@ -3743,7 +3718,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_insert_Customer_object": { "fields": { @@ -3855,7 +3831,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_insert_Customer_response": { "description": "Responses from the 'v1_insert_Customer' procedure", @@ -3877,7 +3854,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_insert_Employee_object": { "fields": { @@ -4007,7 +3985,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_insert_Employee_response": { "description": "Responses from the 'v1_insert_Employee' procedure", @@ -4029,7 +4008,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_insert_Genre_object": { "fields": { @@ -4048,7 +4028,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_insert_Genre_response": { "description": "Responses from the 'v1_insert_Genre' procedure", @@ -4070,7 +4051,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_insert_InvoiceLine_object": { "fields": { @@ -4104,7 +4086,8 @@ expression: result "name": "numeric" } } - } + }, + "foreign_keys": {} }, "v1_insert_InvoiceLine_response": { "description": "Responses from the 'v1_insert_InvoiceLine' procedure", @@ -4126,7 +4109,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_insert_Invoice_object": { "fields": { @@ -4199,7 +4183,8 @@ expression: result "name": "numeric" } } - } + }, + "foreign_keys": {} }, "v1_insert_Invoice_response": { "description": "Responses from the 'v1_insert_Invoice' procedure", @@ -4221,7 +4206,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_insert_MediaType_object": { "fields": { @@ -4240,7 +4226,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_insert_MediaType_response": { "description": "Responses from the 'v1_insert_MediaType' procedure", @@ -4262,7 +4249,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_insert_PlaylistTrack_object": { "fields": { @@ -4278,7 +4266,8 @@ expression: result "name": "int4" } } - } + }, + "foreign_keys": {} }, "v1_insert_PlaylistTrack_response": { "description": "Responses from the 'v1_insert_PlaylistTrack' procedure", @@ -4300,7 +4289,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_insert_Playlist_object": { "fields": { @@ -4319,7 +4309,8 @@ expression: result "name": "int4" } } - } + }, + "foreign_keys": {} }, "v1_insert_Playlist_response": { "description": "Responses from the 'v1_insert_Playlist' procedure", @@ -4341,7 +4332,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_insert_Track_object": { "fields": { @@ -4411,7 +4403,8 @@ expression: result "name": "numeric" } } - } + }, + "foreign_keys": {} }, "v1_insert_Track_response": { "description": "Responses from the 'v1_insert_Track' procedure", @@ -4433,7 +4426,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_insert_deck_of_cards_object": { "fields": { @@ -4449,7 +4443,8 @@ expression: result "name": "card_suit" } } - } + }, + "foreign_keys": {} }, "v1_insert_deck_of_cards_response": { "description": "Responses from the 'v1_insert_deck_of_cards' procedure", @@ -4471,7 +4466,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_insert_discoverable_types_root_occurrence_object": { "fields": { @@ -4484,7 +4480,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_insert_discoverable_types_root_occurrence_response": { "description": "Responses from the 'v1_insert_discoverable_types_root_occurrence' procedure", @@ -4506,7 +4503,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_insert_even_numbers_object": { "fields": { @@ -4516,7 +4514,8 @@ expression: result "name": "even_number" } } - } + }, + "foreign_keys": {} }, "v1_insert_even_numbers_response": { "description": "Responses from the 'v1_insert_even_numbers' procedure", @@ -4538,7 +4537,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_insert_group_leader_object": { "fields": { @@ -4569,7 +4569,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_insert_group_leader_response": { "description": "Responses from the 'v1_insert_group_leader' procedure", @@ -4591,7 +4592,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_insert_phone_numbers_object": { "fields": { @@ -4601,7 +4603,8 @@ expression: result "name": "Phone" } } - } + }, + "foreign_keys": {} }, "v1_insert_phone_numbers_response": { "description": "Responses from the 'v1_insert_phone_numbers' procedure", @@ -4623,7 +4626,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "value_types": { "fields": { @@ -4771,7 +4775,8 @@ expression: result } } } - } + }, + "foreign_keys": {} } }, "collections": [ @@ -4786,14 +4791,6 @@ expression: result "AlbumId" ] } - }, - "foreign_keys": { - "FK_AlbumArtistId": { - "column_mapping": { - "ArtistId": "ArtistId" - }, - "foreign_collection": "Artist" - } } }, { @@ -4807,8 +4804,7 @@ expression: result "ArtistId" ] } - }, - "foreign_keys": {} + } }, { "name": "Customer", @@ -4821,14 +4817,6 @@ expression: result "CustomerId" ] } - }, - "foreign_keys": { - "FK_CustomerSupportRepId": { - "column_mapping": { - "SupportRepId": "EmployeeId" - }, - "foreign_collection": "Employee" - } } }, { @@ -4841,14 +4829,6 @@ expression: result "EmployeeId" ] } - }, - "foreign_keys": { - "FK_EmployeeReportsTo": { - "column_mapping": { - "ReportsTo": "EmployeeId" - }, - "foreign_collection": "Employee" - } } }, { @@ -4861,8 +4841,7 @@ expression: result "GenreId" ] } - }, - "foreign_keys": {} + } }, { "name": "Invoice", @@ -4874,14 +4853,6 @@ expression: result "InvoiceId" ] } - }, - "foreign_keys": { - "FK_InvoiceCustomerId": { - "column_mapping": { - "CustomerId": "CustomerId" - }, - "foreign_collection": "Customer" - } } }, { @@ -4894,20 +4865,6 @@ expression: result "InvoiceLineId" ] } - }, - "foreign_keys": { - "FK_InvoiceLineInvoiceId": { - "column_mapping": { - "InvoiceId": "InvoiceId" - }, - "foreign_collection": "Invoice" - }, - "FK_InvoiceLineTrackId": { - "column_mapping": { - "TrackId": "TrackId" - }, - "foreign_collection": "Track" - } } }, { @@ -4920,8 +4877,7 @@ expression: result "MediaTypeId" ] } - }, - "foreign_keys": {} + } }, { "name": "Playlist", @@ -4933,8 +4889,7 @@ expression: result "PlaylistId" ] } - }, - "foreign_keys": {} + } }, { "name": "PlaylistTrack", @@ -4947,20 +4902,6 @@ expression: result "TrackId" ] } - }, - "foreign_keys": { - "FK_PlaylistTrackPlaylistId": { - "column_mapping": { - "PlaylistId": "PlaylistId" - }, - "foreign_collection": "Playlist" - }, - "FK_PlaylistTrackTrackId": { - "column_mapping": { - "TrackId": "TrackId" - }, - "foreign_collection": "Track" - } } }, { @@ -4973,62 +4914,37 @@ expression: result "TrackId" ] } - }, - "foreign_keys": { - "FK_TrackAlbumId": { - "column_mapping": { - "AlbumId": "AlbumId" - }, - "foreign_collection": "Album" - }, - "FK_TrackGenreId": { - "column_mapping": { - "GenreId": "GenreId" - }, - "foreign_collection": "Genre" - }, - "FK_TrackMediaTypeId": { - "column_mapping": { - "MediaTypeId": "MediaTypeId" - }, - "foreign_collection": "MediaType" - } } }, { "name": "deck_of_cards", "arguments": {}, "type": "deck_of_cards", - "uniqueness_constraints": {}, - "foreign_keys": {} + "uniqueness_constraints": {} }, { "name": "discoverable_types_root_occurrence", "arguments": {}, "type": "discoverable_types_root_occurrence", - "uniqueness_constraints": {}, - "foreign_keys": {} + "uniqueness_constraints": {} }, { "name": "even_numbers", "arguments": {}, "type": "even_numbers", - "uniqueness_constraints": {}, - "foreign_keys": {} + "uniqueness_constraints": {} }, { "name": "group_leader", "arguments": {}, "type": "group_leader", - "uniqueness_constraints": {}, - "foreign_keys": {} + "uniqueness_constraints": {} }, { "name": "phone_numbers", "arguments": {}, "type": "phone_numbers", - "uniqueness_constraints": {}, - "foreign_keys": {} + "uniqueness_constraints": {} }, { "name": "address_identity_function", @@ -5045,8 +4961,7 @@ expression: result } }, "type": "address_identity_function", - "uniqueness_constraints": {}, - "foreign_keys": {} + "uniqueness_constraints": {} }, { "name": "album_by_title", @@ -5071,8 +4986,7 @@ expression: result } }, "type": "album_by_title", - "uniqueness_constraints": {}, - "foreign_keys": {} + "uniqueness_constraints": {} }, { "name": "array_reverse", @@ -5093,8 +5007,7 @@ expression: result } }, "type": "array_reverse", - "uniqueness_constraints": {}, - "foreign_keys": {} + "uniqueness_constraints": {} }, { "name": "array_series", @@ -5120,15 +5033,13 @@ expression: result } }, "type": "array_series", - "uniqueness_constraints": {}, - "foreign_keys": {} + "uniqueness_constraints": {} }, { "name": "artist", "arguments": {}, "type": "artist", - "uniqueness_constraints": {}, - "foreign_keys": {} + "uniqueness_constraints": {} }, { "name": "artist_below_id", @@ -5144,8 +5055,7 @@ expression: result } }, "type": "artist_below_id", - "uniqueness_constraints": {}, - "foreign_keys": {} + "uniqueness_constraints": {} }, { "name": "count_elements", @@ -5168,8 +5078,7 @@ expression: result } }, "type": "count_elements", - "uniqueness_constraints": {}, - "foreign_keys": {} + "uniqueness_constraints": {} }, { "name": "make_person", @@ -5195,8 +5104,7 @@ expression: result } }, "type": "make_person", - "uniqueness_constraints": {}, - "foreign_keys": {} + "uniqueness_constraints": {} }, { "name": "organization_identity_function", @@ -5213,8 +5121,7 @@ expression: result } }, "type": "organization_identity_function", - "uniqueness_constraints": {}, - "foreign_keys": {} + "uniqueness_constraints": {} }, { "name": "summarize_organizations", @@ -5237,8 +5144,7 @@ expression: result } }, "type": "summarize_organizations", - "uniqueness_constraints": {}, - "foreign_keys": {} + "uniqueness_constraints": {} }, { "name": "value_types", @@ -5389,8 +5295,7 @@ expression: result } }, "type": "value_types", - "uniqueness_constraints": {}, - "foreign_keys": {} + "uniqueness_constraints": {} } ], "functions": [], @@ -5895,5 +5800,12 @@ expression: result "name": "v1_insert_phone_numbers_response" } } - ] + ], + "capabilities": { + "query": { + "aggregates": { + "count_scalar_type": "int8" + } + } + } } diff --git a/crates/tests/databases-tests/src/cockroach/snapshots/databases_tests__cockroach__schema_tests__schema_test__get_schema.snap b/crates/tests/databases-tests/src/cockroach/snapshots/databases_tests__cockroach__schema_tests__schema_test__get_schema.snap index 015eb5939..d20aa5c39 100644 --- a/crates/tests/databases-tests/src/cockroach/snapshots/databases_tests__cockroach__schema_tests__schema_test__get_schema.snap +++ b/crates/tests/databases-tests/src/cockroach/snapshots/databases_tests__cockroach__schema_tests__schema_test__get_schema.snap @@ -1,6 +1,7 @@ --- source: crates/tests/databases-tests/src/cockroach/schema_tests.rs expression: result +snapshot_kind: text --- { "scalar_types": { @@ -10,6 +11,7 @@ expression: result }, "aggregate_functions": { "bool_and": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -19,6 +21,7 @@ expression: result } }, "bool_or": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -28,6 +31,7 @@ expression: result } }, "every": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -93,22 +97,10 @@ expression: result }, "aggregate_functions": { "max": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "card_suit" - } - } + "type": "max" }, "min": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "card_suit" - } - } + "type": "min" } }, "comparison_operators": { @@ -161,6 +153,7 @@ expression: result }, "aggregate_functions": { "concat_agg": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -367,15 +360,11 @@ expression: result }, "aggregate_functions": { "avg": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "float8" - } - } + "type": "average", + "result_type": "float8" }, "sqrdiff": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -385,6 +374,7 @@ expression: result } }, "stddev": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -394,6 +384,7 @@ expression: result } }, "stddev_pop": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -403,6 +394,7 @@ expression: result } }, "stddev_samp": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -412,15 +404,11 @@ expression: result } }, "sum": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "float8" - } - } + "type": "sum", + "result_type": "float8" }, "var_pop": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -430,6 +418,7 @@ expression: result } }, "var_samp": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -439,6 +428,7 @@ expression: result } }, "variance": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -498,15 +488,11 @@ expression: result }, "aggregate_functions": { "avg": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "float8" - } - } + "type": "average", + "result_type": "float8" }, "sqrdiff": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -516,6 +502,7 @@ expression: result } }, "stddev": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -525,6 +512,7 @@ expression: result } }, "stddev_pop": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -534,6 +522,7 @@ expression: result } }, "stddev_samp": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -543,15 +532,11 @@ expression: result } }, "sum": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "float8" - } - } + "type": "sum", + "result_type": "float8" }, "var_pop": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -561,6 +546,7 @@ expression: result } }, "var_samp": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -570,6 +556,7 @@ expression: result } }, "variance": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -629,15 +616,11 @@ expression: result }, "aggregate_functions": { "avg": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "float8" - } - } + "type": "average", + "result_type": "float8" }, "bit_and": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -647,6 +630,7 @@ expression: result } }, "bit_or": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -656,6 +640,7 @@ expression: result } }, "sqrdiff": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -665,6 +650,7 @@ expression: result } }, "stddev": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -674,6 +660,7 @@ expression: result } }, "stddev_pop": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -683,6 +670,7 @@ expression: result } }, "stddev_samp": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -692,15 +680,11 @@ expression: result } }, "sum": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "float8" - } - } + "type": "sum", + "result_type": "float8" }, "sum_int": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -710,6 +694,7 @@ expression: result } }, "var_pop": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -719,6 +704,7 @@ expression: result } }, "var_samp": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -728,6 +714,7 @@ expression: result } }, "variance": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -737,6 +724,7 @@ expression: result } }, "xor_agg": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -796,15 +784,11 @@ expression: result }, "aggregate_functions": { "avg": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "float8" - } - } + "type": "average", + "result_type": "float8" }, "bit_and": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -814,6 +798,7 @@ expression: result } }, "bit_or": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -823,6 +808,7 @@ expression: result } }, "sqrdiff": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -832,6 +818,7 @@ expression: result } }, "stddev": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -841,6 +828,7 @@ expression: result } }, "stddev_pop": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -850,6 +838,7 @@ expression: result } }, "stddev_samp": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -859,15 +848,11 @@ expression: result } }, "sum": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "float8" - } - } + "type": "sum", + "result_type": "float8" }, "sum_int": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -877,6 +862,7 @@ expression: result } }, "var_pop": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -886,6 +872,7 @@ expression: result } }, "var_samp": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -895,6 +882,7 @@ expression: result } }, "variance": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -904,6 +892,7 @@ expression: result } }, "xor_agg": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -963,6 +952,7 @@ expression: result }, "aggregate_functions": { "avg": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -972,6 +962,7 @@ expression: result } }, "bit_and": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -981,6 +972,7 @@ expression: result } }, "bit_or": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -990,6 +982,7 @@ expression: result } }, "sqrdiff": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -999,6 +992,7 @@ expression: result } }, "stddev": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1008,6 +1002,7 @@ expression: result } }, "stddev_pop": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1017,6 +1012,7 @@ expression: result } }, "stddev_samp": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1026,6 +1022,7 @@ expression: result } }, "sum": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1035,6 +1032,7 @@ expression: result } }, "sum_int": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1044,6 +1042,7 @@ expression: result } }, "var_pop": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1053,6 +1052,7 @@ expression: result } }, "var_samp": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1062,6 +1062,7 @@ expression: result } }, "variance": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1071,6 +1072,7 @@ expression: result } }, "xor_agg": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1125,8 +1127,12 @@ expression: result } }, "interval": { + "representation": { + "type": "json" + }, "aggregate_functions": { "avg": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1136,6 +1142,7 @@ expression: result } }, "sum": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1195,6 +1202,7 @@ expression: result }, "aggregate_functions": { "avg": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1204,6 +1212,7 @@ expression: result } }, "sqrdiff": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1213,6 +1222,7 @@ expression: result } }, "stddev": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1222,6 +1232,7 @@ expression: result } }, "stddev_pop": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1231,6 +1242,7 @@ expression: result } }, "stddev_samp": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1240,6 +1252,7 @@ expression: result } }, "sum": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1249,6 +1262,7 @@ expression: result } }, "var_pop": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1258,6 +1272,7 @@ expression: result } }, "var_samp": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1267,6 +1282,7 @@ expression: result } }, "variance": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1326,6 +1342,7 @@ expression: result }, "aggregate_functions": { "concat_agg": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1483,6 +1500,7 @@ expression: result }, "aggregate_functions": { "avg": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1492,6 +1510,7 @@ expression: result } }, "sum": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1747,6 +1766,7 @@ expression: result }, "aggregate_functions": { "concat_agg": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1924,6 +1944,16 @@ expression: result "name": "varchar" } } + }, + "foreign_keys": { + "FK_AlbumArtistId": { + "column_mapping": { + "ArtistId": [ + "ArtistId" + ] + }, + "foreign_collection": "Artist" + } } }, "Artist": { @@ -1946,7 +1976,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "Customer": { "description": "The record of all customers", @@ -2059,6 +2090,16 @@ expression: result } } } + }, + "foreign_keys": { + "FK_CustomerSupportRepId": { + "column_mapping": { + "SupportRepId": [ + "EmployeeId" + ] + }, + "foreign_collection": "Employee" + } } }, "Employee": { @@ -2189,6 +2230,16 @@ expression: result } } } + }, + "foreign_keys": { + "FK_EmployeeReportsTo": { + "column_mapping": { + "ReportsTo": [ + "EmployeeId" + ] + }, + "foreign_collection": "Employee" + } } }, "Genre": { @@ -2208,7 +2259,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "Invoice": { "fields": { @@ -2281,6 +2333,16 @@ expression: result "name": "numeric" } } + }, + "foreign_keys": { + "FK_InvoiceCustomerId": { + "column_mapping": { + "CustomerId": [ + "CustomerId" + ] + }, + "foreign_collection": "Customer" + } } }, "InvoiceLine": { @@ -2315,6 +2377,24 @@ expression: result "name": "numeric" } } + }, + "foreign_keys": { + "FK_InvoiceLineInvoiceId": { + "column_mapping": { + "InvoiceId": [ + "InvoiceId" + ] + }, + "foreign_collection": "Invoice" + }, + "FK_InvoiceLineTrackId": { + "column_mapping": { + "TrackId": [ + "TrackId" + ] + }, + "foreign_collection": "Track" + } } }, "MediaType": { @@ -2334,7 +2414,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "Playlist": { "fields": { @@ -2353,7 +2434,8 @@ expression: result "name": "int8" } } - } + }, + "foreign_keys": {} }, "PlaylistTrack": { "fields": { @@ -2369,6 +2451,24 @@ expression: result "name": "int8" } } + }, + "foreign_keys": { + "FK_PlaylistTrackPlaylistId": { + "column_mapping": { + "PlaylistId": [ + "PlaylistId" + ] + }, + "foreign_collection": "Playlist" + }, + "FK_PlaylistTrackTrackId": { + "column_mapping": { + "TrackId": [ + "TrackId" + ] + }, + "foreign_collection": "Track" + } } }, "Track": { @@ -2439,6 +2539,32 @@ expression: result "name": "numeric" } } + }, + "foreign_keys": { + "FK_TrackAlbumId": { + "column_mapping": { + "AlbumId": [ + "AlbumId" + ] + }, + "foreign_collection": "Album" + }, + "FK_TrackGenreId": { + "column_mapping": { + "GenreId": [ + "GenreId" + ] + }, + "foreign_collection": "Genre" + }, + "FK_TrackMediaTypeId": { + "column_mapping": { + "MediaTypeId": [ + "MediaTypeId" + ] + }, + "foreign_collection": "MediaType" + } } }, "address_identity_function": { @@ -2453,7 +2579,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "album_by_title": { "fields": { @@ -2484,7 +2611,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "array_reverse": { "description": "A native query used to test support for arrays as inputs", @@ -2505,7 +2633,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "array_series": { "description": "A native query used to test support for arrays", @@ -2534,7 +2663,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "artist": { "fields": { @@ -2556,7 +2686,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "artist_below_id": { "fields": { @@ -2578,7 +2709,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "count_elements": { "description": "A native query used to test support array-valued variables", @@ -2592,7 +2724,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "deck_of_cards": { "fields": { @@ -2614,7 +2747,8 @@ expression: result "name": "card_suit" } } - } + }, + "foreign_keys": {} }, "delete_playlist_track": { "fields": { @@ -2636,7 +2770,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "delete_playlist_track_response": { "description": "Responses from the 'delete_playlist_track' procedure", @@ -2658,7 +2793,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "discoverable_types_root_occurrence": { "fields": { @@ -2677,7 +2813,8 @@ expression: result "name": "int8" } } - } + }, + "foreign_keys": {} }, "insert_album": { "fields": { @@ -2708,7 +2845,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "insert_album_response": { "description": "Responses from the 'insert_album' procedure", @@ -2730,7 +2868,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "insert_artist": { "fields": { @@ -2752,7 +2891,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "insert_artist_response": { "description": "Responses from the 'insert_artist' procedure", @@ -2774,7 +2914,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "pg_extension_spatial_ref_sys": { "description": "Shows all defined Spatial Reference Identifiers (SRIDs). Matches PostGIS' spatial_ref_sys table.", @@ -2824,7 +2965,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_delete_Album_by_AlbumId_response": { "description": "Responses from the 'v1_delete_Album_by_AlbumId' procedure", @@ -2846,7 +2988,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_delete_Artist_by_ArtistId_response": { "description": "Responses from the 'v1_delete_Artist_by_ArtistId' procedure", @@ -2868,7 +3011,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_delete_Customer_by_CustomerId_response": { "description": "Responses from the 'v1_delete_Customer_by_CustomerId' procedure", @@ -2890,7 +3034,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_delete_Employee_by_EmployeeId_response": { "description": "Responses from the 'v1_delete_Employee_by_EmployeeId' procedure", @@ -2912,7 +3057,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_delete_Genre_by_GenreId_response": { "description": "Responses from the 'v1_delete_Genre_by_GenreId' procedure", @@ -2934,7 +3080,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_delete_InvoiceLine_by_InvoiceLineId_response": { "description": "Responses from the 'v1_delete_InvoiceLine_by_InvoiceLineId' procedure", @@ -2956,7 +3103,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_delete_Invoice_by_InvoiceId_response": { "description": "Responses from the 'v1_delete_Invoice_by_InvoiceId' procedure", @@ -2978,7 +3126,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_delete_MediaType_by_MediaTypeId_response": { "description": "Responses from the 'v1_delete_MediaType_by_MediaTypeId' procedure", @@ -3000,7 +3149,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_delete_Playlist_by_PlaylistId_response": { "description": "Responses from the 'v1_delete_Playlist_by_PlaylistId' procedure", @@ -3022,7 +3172,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_delete_Track_by_TrackId_response": { "description": "Responses from the 'v1_delete_Track_by_TrackId' procedure", @@ -3044,7 +3195,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_delete_deck_of_cards_by_rowid_response": { "description": "Responses from the 'v1_delete_deck_of_cards_by_rowid' procedure", @@ -3066,7 +3218,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_delete_discoverable_types_root_occurrence_by_rowid_response": { "description": "Responses from the 'v1_delete_discoverable_types_root_occurrence_by_rowid' procedure", @@ -3088,7 +3241,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_insert_Album_object": { "fields": { @@ -3113,7 +3267,8 @@ expression: result "name": "varchar" } } - } + }, + "foreign_keys": {} }, "v1_insert_Album_response": { "description": "Responses from the 'v1_insert_Album' procedure", @@ -3135,7 +3290,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_insert_Artist_object": { "fields": { @@ -3156,7 +3312,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_insert_Artist_response": { "description": "Responses from the 'v1_insert_Artist' procedure", @@ -3178,7 +3335,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_insert_Customer_object": { "fields": { @@ -3290,7 +3448,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_insert_Customer_response": { "description": "Responses from the 'v1_insert_Customer' procedure", @@ -3312,7 +3471,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_insert_Employee_object": { "fields": { @@ -3442,7 +3602,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_insert_Employee_response": { "description": "Responses from the 'v1_insert_Employee' procedure", @@ -3464,7 +3625,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_insert_Genre_object": { "fields": { @@ -3483,7 +3645,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_insert_Genre_response": { "description": "Responses from the 'v1_insert_Genre' procedure", @@ -3505,7 +3668,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_insert_InvoiceLine_object": { "fields": { @@ -3539,7 +3703,8 @@ expression: result "name": "numeric" } } - } + }, + "foreign_keys": {} }, "v1_insert_InvoiceLine_response": { "description": "Responses from the 'v1_insert_InvoiceLine' procedure", @@ -3561,7 +3726,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_insert_Invoice_object": { "fields": { @@ -3634,7 +3800,8 @@ expression: result "name": "numeric" } } - } + }, + "foreign_keys": {} }, "v1_insert_Invoice_response": { "description": "Responses from the 'v1_insert_Invoice' procedure", @@ -3656,7 +3823,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_insert_MediaType_object": { "fields": { @@ -3675,7 +3843,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_insert_MediaType_response": { "description": "Responses from the 'v1_insert_MediaType' procedure", @@ -3697,7 +3866,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_insert_PlaylistTrack_object": { "fields": { @@ -3713,7 +3883,8 @@ expression: result "name": "int8" } } - } + }, + "foreign_keys": {} }, "v1_insert_PlaylistTrack_response": { "description": "Responses from the 'v1_insert_PlaylistTrack' procedure", @@ -3735,7 +3906,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_insert_Playlist_object": { "fields": { @@ -3754,7 +3926,8 @@ expression: result "name": "int8" } } - } + }, + "foreign_keys": {} }, "v1_insert_Playlist_response": { "description": "Responses from the 'v1_insert_Playlist' procedure", @@ -3776,7 +3949,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_insert_Track_object": { "fields": { @@ -3846,7 +4020,8 @@ expression: result "name": "numeric" } } - } + }, + "foreign_keys": {} }, "v1_insert_Track_response": { "description": "Responses from the 'v1_insert_Track' procedure", @@ -3868,7 +4043,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_insert_deck_of_cards_object": { "fields": { @@ -3893,7 +4069,8 @@ expression: result "name": "card_suit" } } - } + }, + "foreign_keys": {} }, "v1_insert_deck_of_cards_response": { "description": "Responses from the 'v1_insert_deck_of_cards' procedure", @@ -3915,7 +4092,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_insert_discoverable_types_root_occurrence_object": { "fields": { @@ -3937,7 +4115,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_insert_discoverable_types_root_occurrence_response": { "description": "Responses from the 'v1_insert_discoverable_types_root_occurrence' procedure", @@ -3959,7 +4138,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_insert_pg_extension_spatial_ref_sys_object": { "fields": { @@ -4008,7 +4188,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "v1_insert_pg_extension_spatial_ref_sys_response": { "description": "Responses from the 'v1_insert_pg_extension_spatial_ref_sys' procedure", @@ -4030,7 +4211,8 @@ expression: result } } } - } + }, + "foreign_keys": {} }, "value_types": { "fields": { @@ -4178,7 +4360,8 @@ expression: result } } } - } + }, + "foreign_keys": {} } }, "collections": [ @@ -4193,14 +4376,6 @@ expression: result "AlbumId" ] } - }, - "foreign_keys": { - "FK_AlbumArtistId": { - "column_mapping": { - "ArtistId": "ArtistId" - }, - "foreign_collection": "Artist" - } } }, { @@ -4214,8 +4389,7 @@ expression: result "ArtistId" ] } - }, - "foreign_keys": {} + } }, { "name": "Customer", @@ -4228,14 +4402,6 @@ expression: result "CustomerId" ] } - }, - "foreign_keys": { - "FK_CustomerSupportRepId": { - "column_mapping": { - "SupportRepId": "EmployeeId" - }, - "foreign_collection": "Employee" - } } }, { @@ -4248,14 +4414,6 @@ expression: result "EmployeeId" ] } - }, - "foreign_keys": { - "FK_EmployeeReportsTo": { - "column_mapping": { - "ReportsTo": "EmployeeId" - }, - "foreign_collection": "Employee" - } } }, { @@ -4268,8 +4426,7 @@ expression: result "GenreId" ] } - }, - "foreign_keys": {} + } }, { "name": "Invoice", @@ -4281,14 +4438,6 @@ expression: result "InvoiceId" ] } - }, - "foreign_keys": { - "FK_InvoiceCustomerId": { - "column_mapping": { - "CustomerId": "CustomerId" - }, - "foreign_collection": "Customer" - } } }, { @@ -4301,20 +4450,6 @@ expression: result "InvoiceLineId" ] } - }, - "foreign_keys": { - "FK_InvoiceLineInvoiceId": { - "column_mapping": { - "InvoiceId": "InvoiceId" - }, - "foreign_collection": "Invoice" - }, - "FK_InvoiceLineTrackId": { - "column_mapping": { - "TrackId": "TrackId" - }, - "foreign_collection": "Track" - } } }, { @@ -4327,8 +4462,7 @@ expression: result "MediaTypeId" ] } - }, - "foreign_keys": {} + } }, { "name": "Playlist", @@ -4340,8 +4474,7 @@ expression: result "PlaylistId" ] } - }, - "foreign_keys": {} + } }, { "name": "PlaylistTrack", @@ -4354,20 +4487,6 @@ expression: result "TrackId" ] } - }, - "foreign_keys": { - "FK_PlaylistTrackPlaylistId": { - "column_mapping": { - "PlaylistId": "PlaylistId" - }, - "foreign_collection": "Playlist" - }, - "FK_PlaylistTrackTrackId": { - "column_mapping": { - "TrackId": "TrackId" - }, - "foreign_collection": "Track" - } } }, { @@ -4380,26 +4499,6 @@ expression: result "TrackId" ] } - }, - "foreign_keys": { - "FK_TrackAlbumId": { - "column_mapping": { - "AlbumId": "AlbumId" - }, - "foreign_collection": "Album" - }, - "FK_TrackGenreId": { - "column_mapping": { - "GenreId": "GenreId" - }, - "foreign_collection": "Genre" - }, - "FK_TrackMediaTypeId": { - "column_mapping": { - "MediaTypeId": "MediaTypeId" - }, - "foreign_collection": "MediaType" - } } }, { @@ -4412,8 +4511,7 @@ expression: result "rowid" ] } - }, - "foreign_keys": {} + } }, { "name": "discoverable_types_root_occurrence", @@ -4425,16 +4523,14 @@ expression: result "rowid" ] } - }, - "foreign_keys": {} + } }, { "name": "pg_extension_spatial_ref_sys", "description": "Shows all defined Spatial Reference Identifiers (SRIDs). Matches PostGIS' spatial_ref_sys table.", "arguments": {}, "type": "pg_extension_spatial_ref_sys", - "uniqueness_constraints": {}, - "foreign_keys": {} + "uniqueness_constraints": {} }, { "name": "address_identity_function", @@ -4451,8 +4547,7 @@ expression: result } }, "type": "address_identity_function", - "uniqueness_constraints": {}, - "foreign_keys": {} + "uniqueness_constraints": {} }, { "name": "album_by_title", @@ -4477,8 +4572,7 @@ expression: result } }, "type": "album_by_title", - "uniqueness_constraints": {}, - "foreign_keys": {} + "uniqueness_constraints": {} }, { "name": "array_reverse", @@ -4499,8 +4593,7 @@ expression: result } }, "type": "array_reverse", - "uniqueness_constraints": {}, - "foreign_keys": {} + "uniqueness_constraints": {} }, { "name": "array_series", @@ -4526,15 +4619,13 @@ expression: result } }, "type": "array_series", - "uniqueness_constraints": {}, - "foreign_keys": {} + "uniqueness_constraints": {} }, { "name": "artist", "arguments": {}, "type": "artist", - "uniqueness_constraints": {}, - "foreign_keys": {} + "uniqueness_constraints": {} }, { "name": "artist_below_id", @@ -4550,8 +4641,7 @@ expression: result } }, "type": "artist_below_id", - "uniqueness_constraints": {}, - "foreign_keys": {} + "uniqueness_constraints": {} }, { "name": "count_elements", @@ -4574,8 +4664,7 @@ expression: result } }, "type": "count_elements", - "uniqueness_constraints": {}, - "foreign_keys": {} + "uniqueness_constraints": {} }, { "name": "value_types", @@ -4726,8 +4815,7 @@ expression: result } }, "type": "value_types", - "uniqueness_constraints": {}, - "foreign_keys": {} + "uniqueness_constraints": {} } ], "functions": [], @@ -5232,5 +5320,12 @@ expression: result "name": "v1_insert_pg_extension_spatial_ref_sys_response" } } - ] + ], + "capabilities": { + "query": { + "aggregates": { + "count_scalar_type": "int8" + } + } + } } diff --git a/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__cli_version3_tests__postgres_current_only_configure_initial_configuration_is_unchanged.snap b/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__cli_version3_tests__postgres_current_only_configure_initial_configuration_is_unchanged.snap index d0a395524..b8c031337 100644 --- a/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__cli_version3_tests__postgres_current_only_configure_initial_configuration_is_unchanged.snap +++ b/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__cli_version3_tests__postgres_current_only_configure_initial_configuration_is_unchanged.snap @@ -1612,13 +1612,13 @@ snapshot_kind: text }, "_gt": { "operatorName": ">", - "operatorKind": "custom", + "operatorKind": "greaterThan", "argumentType": "Phone", "isInfix": true }, "_gte": { "operatorName": ">=", - "operatorKind": "custom", + "operatorKind": "greaterThanOrEqual", "argumentType": "Phone", "isInfix": true }, @@ -1648,13 +1648,13 @@ snapshot_kind: text }, "_lt": { "operatorName": "<", - "operatorKind": "custom", + "operatorKind": "lessThan", "argumentType": "Phone", "isInfix": true }, "_lte": { "operatorName": "<=", - "operatorKind": "custom", + "operatorKind": "lessThanOrEqual", "argumentType": "Phone", "isInfix": true }, @@ -1740,13 +1740,13 @@ snapshot_kind: text }, "_gt": { "operatorName": ">", - "operatorKind": "custom", + "operatorKind": "greaterThan", "argumentType": "bool", "isInfix": true }, "_gte": { "operatorName": ">=", - "operatorKind": "custom", + "operatorKind": "greaterThanOrEqual", "argumentType": "bool", "isInfix": true }, @@ -1758,13 +1758,13 @@ snapshot_kind: text }, "_lt": { "operatorName": "<", - "operatorKind": "custom", + "operatorKind": "lessThan", "argumentType": "bool", "isInfix": true }, "_lte": { "operatorName": "<=", - "operatorKind": "custom", + "operatorKind": "lessThanOrEqual", "argumentType": "bool", "isInfix": true }, @@ -1784,13 +1784,13 @@ snapshot_kind: text }, "_gt": { "operatorName": ">", - "operatorKind": "custom", + "operatorKind": "greaterThan", "argumentType": "card_suit", "isInfix": true }, "_gte": { "operatorName": ">=", - "operatorKind": "custom", + "operatorKind": "greaterThanOrEqual", "argumentType": "card_suit", "isInfix": true }, @@ -1802,13 +1802,13 @@ snapshot_kind: text }, "_lt": { "operatorName": "<", - "operatorKind": "custom", + "operatorKind": "lessThan", "argumentType": "card_suit", "isInfix": true }, "_lte": { "operatorName": "<=", - "operatorKind": "custom", + "operatorKind": "lessThanOrEqual", "argumentType": "card_suit", "isInfix": true }, @@ -1828,13 +1828,13 @@ snapshot_kind: text }, "_gt": { "operatorName": ">", - "operatorKind": "custom", + "operatorKind": "greaterThan", "argumentType": "cidr", "isInfix": true }, "_gte": { "operatorName": ">=", - "operatorKind": "custom", + "operatorKind": "greaterThanOrEqual", "argumentType": "cidr", "isInfix": true }, @@ -1846,13 +1846,13 @@ snapshot_kind: text }, "_lt": { "operatorName": "<", - "operatorKind": "custom", + "operatorKind": "lessThan", "argumentType": "cidr", "isInfix": true }, "_lte": { "operatorName": "<=", - "operatorKind": "custom", + "operatorKind": "lessThanOrEqual", "argumentType": "cidr", "isInfix": true }, @@ -1896,13 +1896,13 @@ snapshot_kind: text }, "_gt": { "operatorName": ">", - "operatorKind": "custom", + "operatorKind": "greaterThan", "argumentType": "date", "isInfix": true }, "_gte": { "operatorName": ">=", - "operatorKind": "custom", + "operatorKind": "greaterThanOrEqual", "argumentType": "date", "isInfix": true }, @@ -1914,13 +1914,13 @@ snapshot_kind: text }, "_lt": { "operatorName": "<", - "operatorKind": "custom", + "operatorKind": "lessThan", "argumentType": "date", "isInfix": true }, "_lte": { "operatorName": "<=", - "operatorKind": "custom", + "operatorKind": "lessThanOrEqual", "argumentType": "date", "isInfix": true }, @@ -1940,13 +1940,13 @@ snapshot_kind: text }, "_gt": { "operatorName": ">", - "operatorKind": "custom", + "operatorKind": "greaterThan", "argumentType": "even_number", "isInfix": true }, "_gte": { "operatorName": ">=", - "operatorKind": "custom", + "operatorKind": "greaterThanOrEqual", "argumentType": "even_number", "isInfix": true }, @@ -1958,13 +1958,13 @@ snapshot_kind: text }, "_lt": { "operatorName": "<", - "operatorKind": "custom", + "operatorKind": "lessThan", "argumentType": "even_number", "isInfix": true }, "_lte": { "operatorName": "<=", - "operatorKind": "custom", + "operatorKind": "lessThanOrEqual", "argumentType": "even_number", "isInfix": true }, @@ -1984,13 +1984,13 @@ snapshot_kind: text }, "_gt": { "operatorName": ">", - "operatorKind": "custom", + "operatorKind": "greaterThan", "argumentType": "float8", "isInfix": true }, "_gte": { "operatorName": ">=", - "operatorKind": "custom", + "operatorKind": "greaterThanOrEqual", "argumentType": "float8", "isInfix": true }, @@ -2002,13 +2002,13 @@ snapshot_kind: text }, "_lt": { "operatorName": "<", - "operatorKind": "custom", + "operatorKind": "lessThan", "argumentType": "float8", "isInfix": true }, "_lte": { "operatorName": "<=", - "operatorKind": "custom", + "operatorKind": "lessThanOrEqual", "argumentType": "float8", "isInfix": true }, @@ -2028,13 +2028,13 @@ snapshot_kind: text }, "_gt": { "operatorName": ">", - "operatorKind": "custom", + "operatorKind": "greaterThan", "argumentType": "int2", "isInfix": true }, "_gte": { "operatorName": ">=", - "operatorKind": "custom", + "operatorKind": "greaterThanOrEqual", "argumentType": "int2", "isInfix": true }, @@ -2046,13 +2046,13 @@ snapshot_kind: text }, "_lt": { "operatorName": "<", - "operatorKind": "custom", + "operatorKind": "lessThan", "argumentType": "int2", "isInfix": true }, "_lte": { "operatorName": "<=", - "operatorKind": "custom", + "operatorKind": "lessThanOrEqual", "argumentType": "int2", "isInfix": true }, @@ -2072,13 +2072,13 @@ snapshot_kind: text }, "_gt": { "operatorName": ">", - "operatorKind": "custom", + "operatorKind": "greaterThan", "argumentType": "int4", "isInfix": true }, "_gte": { "operatorName": ">=", - "operatorKind": "custom", + "operatorKind": "greaterThanOrEqual", "argumentType": "int4", "isInfix": true }, @@ -2090,13 +2090,13 @@ snapshot_kind: text }, "_lt": { "operatorName": "<", - "operatorKind": "custom", + "operatorKind": "lessThan", "argumentType": "int4", "isInfix": true }, "_lte": { "operatorName": "<=", - "operatorKind": "custom", + "operatorKind": "lessThanOrEqual", "argumentType": "int4", "isInfix": true }, @@ -2116,13 +2116,13 @@ snapshot_kind: text }, "_gt": { "operatorName": ">", - "operatorKind": "custom", + "operatorKind": "greaterThan", "argumentType": "int8", "isInfix": true }, "_gte": { "operatorName": ">=", - "operatorKind": "custom", + "operatorKind": "greaterThanOrEqual", "argumentType": "int8", "isInfix": true }, @@ -2134,13 +2134,13 @@ snapshot_kind: text }, "_lt": { "operatorName": "<", - "operatorKind": "custom", + "operatorKind": "lessThan", "argumentType": "int8", "isInfix": true }, "_lte": { "operatorName": "<=", - "operatorKind": "custom", + "operatorKind": "lessThanOrEqual", "argumentType": "int8", "isInfix": true }, @@ -2160,13 +2160,13 @@ snapshot_kind: text }, "_gt": { "operatorName": ">", - "operatorKind": "custom", + "operatorKind": "greaterThan", "argumentType": "numeric", "isInfix": true }, "_gte": { "operatorName": ">=", - "operatorKind": "custom", + "operatorKind": "greaterThanOrEqual", "argumentType": "numeric", "isInfix": true }, @@ -2178,13 +2178,13 @@ snapshot_kind: text }, "_lt": { "operatorName": "<", - "operatorKind": "custom", + "operatorKind": "lessThan", "argumentType": "numeric", "isInfix": true }, "_lte": { "operatorName": "<=", - "operatorKind": "custom", + "operatorKind": "lessThanOrEqual", "argumentType": "numeric", "isInfix": true }, @@ -2204,13 +2204,13 @@ snapshot_kind: text }, "_gt": { "operatorName": ">", - "operatorKind": "custom", + "operatorKind": "greaterThan", "argumentType": "text", "isInfix": true }, "_gte": { "operatorName": ">=", - "operatorKind": "custom", + "operatorKind": "greaterThanOrEqual", "argumentType": "text", "isInfix": true }, @@ -2240,13 +2240,13 @@ snapshot_kind: text }, "_lt": { "operatorName": "<", - "operatorKind": "custom", + "operatorKind": "lessThan", "argumentType": "text", "isInfix": true }, "_lte": { "operatorName": "<=", - "operatorKind": "custom", + "operatorKind": "lessThanOrEqual", "argumentType": "text", "isInfix": true }, @@ -2332,13 +2332,13 @@ snapshot_kind: text }, "_gt": { "operatorName": ">", - "operatorKind": "custom", + "operatorKind": "greaterThan", "argumentType": "timestamp", "isInfix": true }, "_gte": { "operatorName": ">=", - "operatorKind": "custom", + "operatorKind": "greaterThanOrEqual", "argumentType": "timestamp", "isInfix": true }, @@ -2350,13 +2350,13 @@ snapshot_kind: text }, "_lt": { "operatorName": "<", - "operatorKind": "custom", + "operatorKind": "lessThan", "argumentType": "timestamp", "isInfix": true }, "_lte": { "operatorName": "<=", - "operatorKind": "custom", + "operatorKind": "lessThanOrEqual", "argumentType": "timestamp", "isInfix": true }, @@ -2376,13 +2376,13 @@ snapshot_kind: text }, "_gt": { "operatorName": ">", - "operatorKind": "custom", + "operatorKind": "greaterThan", "argumentType": "varchar", "isInfix": true }, "_gte": { "operatorName": ">=", - "operatorKind": "custom", + "operatorKind": "greaterThanOrEqual", "argumentType": "varchar", "isInfix": true }, @@ -2412,13 +2412,13 @@ snapshot_kind: text }, "_lt": { "operatorName": "<", - "operatorKind": "custom", + "operatorKind": "lessThan", "argumentType": "varchar", "isInfix": true }, "_lte": { "operatorName": "<=", - "operatorKind": "custom", + "operatorKind": "lessThanOrEqual", "argumentType": "varchar", "isInfix": true }, @@ -2547,22 +2547,22 @@ snapshot_kind: text { "operatorName": "<=", "exposedName": "_lte", - "operatorKind": "custom" + "operatorKind": "lessThanOrEqual" }, { "operatorName": ">", "exposedName": "_gt", - "operatorKind": "custom" + "operatorKind": "greaterThan" }, { "operatorName": ">=", "exposedName": "_gte", - "operatorKind": "custom" + "operatorKind": "greaterThanOrEqual" }, { "operatorName": "<", "exposedName": "_lt", - "operatorKind": "custom" + "operatorKind": "lessThan" }, { "operatorName": "<>", diff --git a/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__cli_version4_tests__postgres_current_only_configure_initial_configuration_is_unchanged.snap b/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__cli_version4_tests__postgres_current_only_configure_initial_configuration_is_unchanged.snap index c9f8872da..846fb4e4e 100644 --- a/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__cli_version4_tests__postgres_current_only_configure_initial_configuration_is_unchanged.snap +++ b/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__cli_version4_tests__postgres_current_only_configure_initial_configuration_is_unchanged.snap @@ -1334,13 +1334,13 @@ snapshot_kind: text }, "_gt": { "operatorName": ">", - "operatorKind": "custom", + "operatorKind": "greaterThan", "argumentType": "Phone", "isInfix": true }, "_gte": { "operatorName": ">=", - "operatorKind": "custom", + "operatorKind": "greaterThanOrEqual", "argumentType": "Phone", "isInfix": true }, @@ -1370,13 +1370,13 @@ snapshot_kind: text }, "_lt": { "operatorName": "<", - "operatorKind": "custom", + "operatorKind": "lessThan", "argumentType": "Phone", "isInfix": true }, "_lte": { "operatorName": "<=", - "operatorKind": "custom", + "operatorKind": "lessThanOrEqual", "argumentType": "Phone", "isInfix": true }, @@ -1479,13 +1479,13 @@ snapshot_kind: text }, "_gt": { "operatorName": ">", - "operatorKind": "custom", + "operatorKind": "greaterThan", "argumentType": "bool", "isInfix": true }, "_gte": { "operatorName": ">=", - "operatorKind": "custom", + "operatorKind": "greaterThanOrEqual", "argumentType": "bool", "isInfix": true }, @@ -1497,13 +1497,13 @@ snapshot_kind: text }, "_lt": { "operatorName": "<", - "operatorKind": "custom", + "operatorKind": "lessThan", "argumentType": "bool", "isInfix": true }, "_lte": { "operatorName": "<=", - "operatorKind": "custom", + "operatorKind": "lessThanOrEqual", "argumentType": "bool", "isInfix": true }, @@ -1537,13 +1537,13 @@ snapshot_kind: text }, "_gt": { "operatorName": ">", - "operatorKind": "custom", + "operatorKind": "greaterThan", "argumentType": "card_suit", "isInfix": true }, "_gte": { "operatorName": ">=", - "operatorKind": "custom", + "operatorKind": "greaterThanOrEqual", "argumentType": "card_suit", "isInfix": true }, @@ -1555,13 +1555,13 @@ snapshot_kind: text }, "_lt": { "operatorName": "<", - "operatorKind": "custom", + "operatorKind": "lessThan", "argumentType": "card_suit", "isInfix": true }, "_lte": { "operatorName": "<=", - "operatorKind": "custom", + "operatorKind": "lessThanOrEqual", "argumentType": "card_suit", "isInfix": true }, @@ -1602,13 +1602,13 @@ snapshot_kind: text }, "_gt": { "operatorName": ">", - "operatorKind": "custom", + "operatorKind": "greaterThan", "argumentType": "cidr", "isInfix": true }, "_gte": { "operatorName": ">=", - "operatorKind": "custom", + "operatorKind": "greaterThanOrEqual", "argumentType": "cidr", "isInfix": true }, @@ -1620,13 +1620,13 @@ snapshot_kind: text }, "_lt": { "operatorName": "<", - "operatorKind": "custom", + "operatorKind": "lessThan", "argumentType": "cidr", "isInfix": true }, "_lte": { "operatorName": "<=", - "operatorKind": "custom", + "operatorKind": "lessThanOrEqual", "argumentType": "cidr", "isInfix": true }, @@ -1684,13 +1684,13 @@ snapshot_kind: text }, "_gt": { "operatorName": ">", - "operatorKind": "custom", + "operatorKind": "greaterThan", "argumentType": "date", "isInfix": true }, "_gte": { "operatorName": ">=", - "operatorKind": "custom", + "operatorKind": "greaterThanOrEqual", "argumentType": "date", "isInfix": true }, @@ -1702,13 +1702,13 @@ snapshot_kind: text }, "_lt": { "operatorName": "<", - "operatorKind": "custom", + "operatorKind": "lessThan", "argumentType": "date", "isInfix": true }, "_lte": { "operatorName": "<=", - "operatorKind": "custom", + "operatorKind": "lessThanOrEqual", "argumentType": "date", "isInfix": true }, @@ -1775,13 +1775,13 @@ snapshot_kind: text }, "_gt": { "operatorName": ">", - "operatorKind": "custom", + "operatorKind": "greaterThan", "argumentType": "even_number", "isInfix": true }, "_gte": { "operatorName": ">=", - "operatorKind": "custom", + "operatorKind": "greaterThanOrEqual", "argumentType": "even_number", "isInfix": true }, @@ -1793,13 +1793,13 @@ snapshot_kind: text }, "_lt": { "operatorName": "<", - "operatorKind": "custom", + "operatorKind": "lessThan", "argumentType": "even_number", "isInfix": true }, "_lte": { "operatorName": "<=", - "operatorKind": "custom", + "operatorKind": "lessThanOrEqual", "argumentType": "even_number", "isInfix": true }, @@ -1857,13 +1857,13 @@ snapshot_kind: text }, "_gt": { "operatorName": ">", - "operatorKind": "custom", + "operatorKind": "greaterThan", "argumentType": "float8", "isInfix": true }, "_gte": { "operatorName": ">=", - "operatorKind": "custom", + "operatorKind": "greaterThanOrEqual", "argumentType": "float8", "isInfix": true }, @@ -1875,13 +1875,13 @@ snapshot_kind: text }, "_lt": { "operatorName": "<", - "operatorKind": "custom", + "operatorKind": "lessThan", "argumentType": "float8", "isInfix": true }, "_lte": { "operatorName": "<=", - "operatorKind": "custom", + "operatorKind": "lessThanOrEqual", "argumentType": "float8", "isInfix": true }, @@ -1915,13 +1915,13 @@ snapshot_kind: text }, "_gt": { "operatorName": ">", - "operatorKind": "custom", + "operatorKind": "greaterThan", "argumentType": "inet", "isInfix": true }, "_gte": { "operatorName": ">=", - "operatorKind": "custom", + "operatorKind": "greaterThanOrEqual", "argumentType": "inet", "isInfix": true }, @@ -1933,13 +1933,13 @@ snapshot_kind: text }, "_lt": { "operatorName": "<", - "operatorKind": "custom", + "operatorKind": "lessThan", "argumentType": "inet", "isInfix": true }, "_lte": { "operatorName": "<=", - "operatorKind": "custom", + "operatorKind": "lessThanOrEqual", "argumentType": "inet", "isInfix": true }, @@ -2030,13 +2030,13 @@ snapshot_kind: text }, "_gt": { "operatorName": ">", - "operatorKind": "custom", + "operatorKind": "greaterThan", "argumentType": "int2", "isInfix": true }, "_gte": { "operatorName": ">=", - "operatorKind": "custom", + "operatorKind": "greaterThanOrEqual", "argumentType": "int2", "isInfix": true }, @@ -2048,13 +2048,13 @@ snapshot_kind: text }, "_lt": { "operatorName": "<", - "operatorKind": "custom", + "operatorKind": "lessThan", "argumentType": "int2", "isInfix": true }, "_lte": { "operatorName": "<=", - "operatorKind": "custom", + "operatorKind": "lessThanOrEqual", "argumentType": "int2", "isInfix": true }, @@ -2121,13 +2121,13 @@ snapshot_kind: text }, "_gt": { "operatorName": ">", - "operatorKind": "custom", + "operatorKind": "greaterThan", "argumentType": "int4", "isInfix": true }, "_gte": { "operatorName": ">=", - "operatorKind": "custom", + "operatorKind": "greaterThanOrEqual", "argumentType": "int4", "isInfix": true }, @@ -2139,13 +2139,13 @@ snapshot_kind: text }, "_lt": { "operatorName": "<", - "operatorKind": "custom", + "operatorKind": "lessThan", "argumentType": "int4", "isInfix": true }, "_lte": { "operatorName": "<=", - "operatorKind": "custom", + "operatorKind": "lessThanOrEqual", "argumentType": "int4", "isInfix": true }, @@ -2212,13 +2212,13 @@ snapshot_kind: text }, "_gt": { "operatorName": ">", - "operatorKind": "custom", + "operatorKind": "greaterThan", "argumentType": "int8", "isInfix": true }, "_gte": { "operatorName": ">=", - "operatorKind": "custom", + "operatorKind": "greaterThanOrEqual", "argumentType": "int8", "isInfix": true }, @@ -2230,13 +2230,13 @@ snapshot_kind: text }, "_lt": { "operatorName": "<", - "operatorKind": "custom", + "operatorKind": "lessThan", "argumentType": "int8", "isInfix": true }, "_lte": { "operatorName": "<=", - "operatorKind": "custom", + "operatorKind": "lessThanOrEqual", "argumentType": "int8", "isInfix": true }, @@ -2294,13 +2294,13 @@ snapshot_kind: text }, "_gt": { "operatorName": ">", - "operatorKind": "custom", + "operatorKind": "greaterThan", "argumentType": "numeric", "isInfix": true }, "_gte": { "operatorName": ">=", - "operatorKind": "custom", + "operatorKind": "greaterThanOrEqual", "argumentType": "numeric", "isInfix": true }, @@ -2312,13 +2312,13 @@ snapshot_kind: text }, "_lt": { "operatorName": "<", - "operatorKind": "custom", + "operatorKind": "lessThan", "argumentType": "numeric", "isInfix": true }, "_lte": { "operatorName": "<=", - "operatorKind": "custom", + "operatorKind": "lessThanOrEqual", "argumentType": "numeric", "isInfix": true }, @@ -2352,13 +2352,13 @@ snapshot_kind: text }, "_gt": { "operatorName": ">", - "operatorKind": "custom", + "operatorKind": "greaterThan", "argumentType": "text", "isInfix": true }, "_gte": { "operatorName": ">=", - "operatorKind": "custom", + "operatorKind": "greaterThanOrEqual", "argumentType": "text", "isInfix": true }, @@ -2388,13 +2388,13 @@ snapshot_kind: text }, "_lt": { "operatorName": "<", - "operatorKind": "custom", + "operatorKind": "lessThan", "argumentType": "text", "isInfix": true }, "_lte": { "operatorName": "<=", - "operatorKind": "custom", + "operatorKind": "lessThanOrEqual", "argumentType": "text", "isInfix": true }, @@ -2494,13 +2494,13 @@ snapshot_kind: text }, "_gt": { "operatorName": ">", - "operatorKind": "custom", + "operatorKind": "greaterThan", "argumentType": "timestamp", "isInfix": true }, "_gte": { "operatorName": ">=", - "operatorKind": "custom", + "operatorKind": "greaterThanOrEqual", "argumentType": "timestamp", "isInfix": true }, @@ -2512,13 +2512,13 @@ snapshot_kind: text }, "_lt": { "operatorName": "<", - "operatorKind": "custom", + "operatorKind": "lessThan", "argumentType": "timestamp", "isInfix": true }, "_lte": { "operatorName": "<=", - "operatorKind": "custom", + "operatorKind": "lessThanOrEqual", "argumentType": "timestamp", "isInfix": true }, @@ -2552,13 +2552,13 @@ snapshot_kind: text }, "_gt": { "operatorName": ">", - "operatorKind": "custom", + "operatorKind": "greaterThan", "argumentType": "varchar", "isInfix": true }, "_gte": { "operatorName": ">=", - "operatorKind": "custom", + "operatorKind": "greaterThanOrEqual", "argumentType": "varchar", "isInfix": true }, @@ -2588,13 +2588,13 @@ snapshot_kind: text }, "_lt": { "operatorName": "<", - "operatorKind": "custom", + "operatorKind": "lessThan", "argumentType": "varchar", "isInfix": true }, "_lte": { "operatorName": "<=", - "operatorKind": "custom", + "operatorKind": "lessThanOrEqual", "argumentType": "varchar", "isInfix": true }, @@ -2871,22 +2871,22 @@ snapshot_kind: text { "operatorName": "<=", "exposedName": "_lte", - "operatorKind": "custom" + "operatorKind": "lessThanOrEqual" }, { "operatorName": ">", "exposedName": "_gt", - "operatorKind": "custom" + "operatorKind": "greaterThan" }, { "operatorName": ">=", "exposedName": "_gte", - "operatorKind": "custom" + "operatorKind": "greaterThanOrEqual" }, { "operatorName": "<", "exposedName": "_lt", - "operatorKind": "custom" + "operatorKind": "lessThan" }, { "operatorName": "<>", diff --git a/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__cli_version5_tests__postgres_current_only_configure_initial_configuration_is_unchanged.snap b/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__cli_version5_tests__postgres_current_only_configure_initial_configuration_is_unchanged.snap index e04a64833..9d84bbc61 100644 --- a/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__cli_version5_tests__postgres_current_only_configure_initial_configuration_is_unchanged.snap +++ b/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__cli_version5_tests__postgres_current_only_configure_initial_configuration_is_unchanged.snap @@ -1335,13 +1335,13 @@ snapshot_kind: text }, "_gt": { "operatorName": ">", - "operatorKind": "custom", + "operatorKind": "greaterThan", "argumentType": "Phone", "isInfix": true }, "_gte": { "operatorName": ">=", - "operatorKind": "custom", + "operatorKind": "greaterThanOrEqual", "argumentType": "Phone", "isInfix": true }, @@ -1371,13 +1371,13 @@ snapshot_kind: text }, "_lt": { "operatorName": "<", - "operatorKind": "custom", + "operatorKind": "lessThan", "argumentType": "Phone", "isInfix": true }, "_lte": { "operatorName": "<=", - "operatorKind": "custom", + "operatorKind": "lessThanOrEqual", "argumentType": "Phone", "isInfix": true }, @@ -1480,13 +1480,13 @@ snapshot_kind: text }, "_gt": { "operatorName": ">", - "operatorKind": "custom", + "operatorKind": "greaterThan", "argumentType": "bool", "isInfix": true }, "_gte": { "operatorName": ">=", - "operatorKind": "custom", + "operatorKind": "greaterThanOrEqual", "argumentType": "bool", "isInfix": true }, @@ -1498,13 +1498,13 @@ snapshot_kind: text }, "_lt": { "operatorName": "<", - "operatorKind": "custom", + "operatorKind": "lessThan", "argumentType": "bool", "isInfix": true }, "_lte": { "operatorName": "<=", - "operatorKind": "custom", + "operatorKind": "lessThanOrEqual", "argumentType": "bool", "isInfix": true }, @@ -1538,13 +1538,13 @@ snapshot_kind: text }, "_gt": { "operatorName": ">", - "operatorKind": "custom", + "operatorKind": "greaterThan", "argumentType": "card_suit", "isInfix": true }, "_gte": { "operatorName": ">=", - "operatorKind": "custom", + "operatorKind": "greaterThanOrEqual", "argumentType": "card_suit", "isInfix": true }, @@ -1556,13 +1556,13 @@ snapshot_kind: text }, "_lt": { "operatorName": "<", - "operatorKind": "custom", + "operatorKind": "lessThan", "argumentType": "card_suit", "isInfix": true }, "_lte": { "operatorName": "<=", - "operatorKind": "custom", + "operatorKind": "lessThanOrEqual", "argumentType": "card_suit", "isInfix": true }, @@ -1603,13 +1603,13 @@ snapshot_kind: text }, "_gt": { "operatorName": ">", - "operatorKind": "custom", + "operatorKind": "greaterThan", "argumentType": "cidr", "isInfix": true }, "_gte": { "operatorName": ">=", - "operatorKind": "custom", + "operatorKind": "greaterThanOrEqual", "argumentType": "cidr", "isInfix": true }, @@ -1621,13 +1621,13 @@ snapshot_kind: text }, "_lt": { "operatorName": "<", - "operatorKind": "custom", + "operatorKind": "lessThan", "argumentType": "cidr", "isInfix": true }, "_lte": { "operatorName": "<=", - "operatorKind": "custom", + "operatorKind": "lessThanOrEqual", "argumentType": "cidr", "isInfix": true }, @@ -1697,13 +1697,13 @@ snapshot_kind: text }, "_gt": { "operatorName": ">", - "operatorKind": "custom", + "operatorKind": "greaterThan", "argumentType": "date", "isInfix": true }, "_gte": { "operatorName": ">=", - "operatorKind": "custom", + "operatorKind": "greaterThanOrEqual", "argumentType": "date", "isInfix": true }, @@ -1715,13 +1715,13 @@ snapshot_kind: text }, "_lt": { "operatorName": "<", - "operatorKind": "custom", + "operatorKind": "lessThan", "argumentType": "date", "isInfix": true }, "_lte": { "operatorName": "<=", - "operatorKind": "custom", + "operatorKind": "lessThanOrEqual", "argumentType": "date", "isInfix": true }, @@ -1788,13 +1788,13 @@ snapshot_kind: text }, "_gt": { "operatorName": ">", - "operatorKind": "custom", + "operatorKind": "greaterThan", "argumentType": "even_number", "isInfix": true }, "_gte": { "operatorName": ">=", - "operatorKind": "custom", + "operatorKind": "greaterThanOrEqual", "argumentType": "even_number", "isInfix": true }, @@ -1806,13 +1806,13 @@ snapshot_kind: text }, "_lt": { "operatorName": "<", - "operatorKind": "custom", + "operatorKind": "lessThan", "argumentType": "even_number", "isInfix": true }, "_lte": { "operatorName": "<=", - "operatorKind": "custom", + "operatorKind": "lessThanOrEqual", "argumentType": "even_number", "isInfix": true }, @@ -1870,13 +1870,13 @@ snapshot_kind: text }, "_gt": { "operatorName": ">", - "operatorKind": "custom", + "operatorKind": "greaterThan", "argumentType": "float8", "isInfix": true }, "_gte": { "operatorName": ">=", - "operatorKind": "custom", + "operatorKind": "greaterThanOrEqual", "argumentType": "float8", "isInfix": true }, @@ -1888,13 +1888,13 @@ snapshot_kind: text }, "_lt": { "operatorName": "<", - "operatorKind": "custom", + "operatorKind": "lessThan", "argumentType": "float8", "isInfix": true }, "_lte": { "operatorName": "<=", - "operatorKind": "custom", + "operatorKind": "lessThanOrEqual", "argumentType": "float8", "isInfix": true }, @@ -1928,13 +1928,13 @@ snapshot_kind: text }, "_gt": { "operatorName": ">", - "operatorKind": "custom", + "operatorKind": "greaterThan", "argumentType": "inet", "isInfix": true }, "_gte": { "operatorName": ">=", - "operatorKind": "custom", + "operatorKind": "greaterThanOrEqual", "argumentType": "inet", "isInfix": true }, @@ -1946,13 +1946,13 @@ snapshot_kind: text }, "_lt": { "operatorName": "<", - "operatorKind": "custom", + "operatorKind": "lessThan", "argumentType": "inet", "isInfix": true }, "_lte": { "operatorName": "<=", - "operatorKind": "custom", + "operatorKind": "lessThanOrEqual", "argumentType": "inet", "isInfix": true }, @@ -2055,13 +2055,13 @@ snapshot_kind: text }, "_gt": { "operatorName": ">", - "operatorKind": "custom", + "operatorKind": "greaterThan", "argumentType": "int2", "isInfix": true }, "_gte": { "operatorName": ">=", - "operatorKind": "custom", + "operatorKind": "greaterThanOrEqual", "argumentType": "int2", "isInfix": true }, @@ -2073,13 +2073,13 @@ snapshot_kind: text }, "_lt": { "operatorName": "<", - "operatorKind": "custom", + "operatorKind": "lessThan", "argumentType": "int2", "isInfix": true }, "_lte": { "operatorName": "<=", - "operatorKind": "custom", + "operatorKind": "lessThanOrEqual", "argumentType": "int2", "isInfix": true }, @@ -2146,13 +2146,13 @@ snapshot_kind: text }, "_gt": { "operatorName": ">", - "operatorKind": "custom", + "operatorKind": "greaterThan", "argumentType": "int4", "isInfix": true }, "_gte": { "operatorName": ">=", - "operatorKind": "custom", + "operatorKind": "greaterThanOrEqual", "argumentType": "int4", "isInfix": true }, @@ -2164,13 +2164,13 @@ snapshot_kind: text }, "_lt": { "operatorName": "<", - "operatorKind": "custom", + "operatorKind": "lessThan", "argumentType": "int4", "isInfix": true }, "_lte": { "operatorName": "<=", - "operatorKind": "custom", + "operatorKind": "lessThanOrEqual", "argumentType": "int4", "isInfix": true }, @@ -2237,13 +2237,13 @@ snapshot_kind: text }, "_gt": { "operatorName": ">", - "operatorKind": "custom", + "operatorKind": "greaterThan", "argumentType": "int8", "isInfix": true }, "_gte": { "operatorName": ">=", - "operatorKind": "custom", + "operatorKind": "greaterThanOrEqual", "argumentType": "int8", "isInfix": true }, @@ -2255,13 +2255,13 @@ snapshot_kind: text }, "_lt": { "operatorName": "<", - "operatorKind": "custom", + "operatorKind": "lessThan", "argumentType": "int8", "isInfix": true }, "_lte": { "operatorName": "<=", - "operatorKind": "custom", + "operatorKind": "lessThanOrEqual", "argumentType": "int8", "isInfix": true }, @@ -2319,13 +2319,13 @@ snapshot_kind: text }, "_gt": { "operatorName": ">", - "operatorKind": "custom", + "operatorKind": "greaterThan", "argumentType": "numeric", "isInfix": true }, "_gte": { "operatorName": ">=", - "operatorKind": "custom", + "operatorKind": "greaterThanOrEqual", "argumentType": "numeric", "isInfix": true }, @@ -2337,13 +2337,13 @@ snapshot_kind: text }, "_lt": { "operatorName": "<", - "operatorKind": "custom", + "operatorKind": "lessThan", "argumentType": "numeric", "isInfix": true }, "_lte": { "operatorName": "<=", - "operatorKind": "custom", + "operatorKind": "lessThanOrEqual", "argumentType": "numeric", "isInfix": true }, @@ -2377,13 +2377,13 @@ snapshot_kind: text }, "_gt": { "operatorName": ">", - "operatorKind": "custom", + "operatorKind": "greaterThan", "argumentType": "text", "isInfix": true }, "_gte": { "operatorName": ">=", - "operatorKind": "custom", + "operatorKind": "greaterThanOrEqual", "argumentType": "text", "isInfix": true }, @@ -2413,13 +2413,13 @@ snapshot_kind: text }, "_lt": { "operatorName": "<", - "operatorKind": "custom", + "operatorKind": "lessThan", "argumentType": "text", "isInfix": true }, "_lte": { "operatorName": "<=", - "operatorKind": "custom", + "operatorKind": "lessThanOrEqual", "argumentType": "text", "isInfix": true }, @@ -2519,13 +2519,13 @@ snapshot_kind: text }, "_gt": { "operatorName": ">", - "operatorKind": "custom", + "operatorKind": "greaterThan", "argumentType": "timestamp", "isInfix": true }, "_gte": { "operatorName": ">=", - "operatorKind": "custom", + "operatorKind": "greaterThanOrEqual", "argumentType": "timestamp", "isInfix": true }, @@ -2537,13 +2537,13 @@ snapshot_kind: text }, "_lt": { "operatorName": "<", - "operatorKind": "custom", + "operatorKind": "lessThan", "argumentType": "timestamp", "isInfix": true }, "_lte": { "operatorName": "<=", - "operatorKind": "custom", + "operatorKind": "lessThanOrEqual", "argumentType": "timestamp", "isInfix": true }, @@ -2577,13 +2577,13 @@ snapshot_kind: text }, "_gt": { "operatorName": ">", - "operatorKind": "custom", + "operatorKind": "greaterThan", "argumentType": "varchar", "isInfix": true }, "_gte": { "operatorName": ">=", - "operatorKind": "custom", + "operatorKind": "greaterThanOrEqual", "argumentType": "varchar", "isInfix": true }, @@ -2613,13 +2613,13 @@ snapshot_kind: text }, "_lt": { "operatorName": "<", - "operatorKind": "custom", + "operatorKind": "lessThan", "argumentType": "varchar", "isInfix": true }, "_lte": { "operatorName": "<=", - "operatorKind": "custom", + "operatorKind": "lessThanOrEqual", "argumentType": "varchar", "isInfix": true }, @@ -2900,22 +2900,22 @@ snapshot_kind: text { "operatorName": "<=", "exposedName": "_lte", - "operatorKind": "custom" + "operatorKind": "lessThanOrEqual" }, { "operatorName": ">", "exposedName": "_gt", - "operatorKind": "custom" + "operatorKind": "greaterThan" }, { "operatorName": ">=", "exposedName": "_gte", - "operatorKind": "custom" + "operatorKind": "greaterThanOrEqual" }, { "operatorName": "<", "exposedName": "_lt", - "operatorKind": "custom" + "operatorKind": "lessThan" }, { "operatorName": "<>", diff --git a/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__explain_tests__mutation__delete_invoice_line.snap b/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__explain_tests__mutation__delete_invoice_line.snap index 62d9ffd50..4a7f3a941 100644 --- a/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__explain_tests__mutation__delete_invoice_line.snap +++ b/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__explain_tests__mutation__delete_invoice_line.snap @@ -1,6 +1,8 @@ --- source: crates/tests/databases-tests/src/postgres/explain_tests.rs +assertion_line: 191 expression: "result.details.get(\"0 delete_InvoiceLine_by_InvoiceLineId SQL Mutation\").unwrap()" +snapshot_kind: text --- EXPLAIN WITH "%0_generated_mutation" AS ( DELETE FROM @@ -10,25 +12,16 @@ EXPLAIN WITH "%0_generated_mutation" AS ( ("%1_InvoiceLine"."InvoiceLineId" = 90) AND EXISTS ( SELECT - 1 + 1 AS "one" FROM - ( - SELECT - "%2_BOOLEXP_Track".* - FROM - ( - SELECT - * - FROM - "public"."Track" AS "%2_BOOLEXP_Track" - WHERE - ( - "%1_InvoiceLine"."TrackId" = "%2_BOOLEXP_Track"."TrackId" - ) - ) AS "%2_BOOLEXP_Track" - ) AS "%3_BOOLEXP_Track" + "public"."Track" AS "%2_Track" WHERE - ("%3_BOOLEXP_Track"."TrackId" = 512) + ( + ("%2_Track"."TrackId" = 512) + AND ( + "%1_InvoiceLine"."TrackId" = "%2_Track"."TrackId" + ) + ) ) ) RETURNING *, true AS "%check__constraint" @@ -36,7 +29,7 @@ EXPLAIN WITH "%0_generated_mutation" AS ( SELECT ( SELECT - json_build_object('result', row_to_json("%7_universe"), 'type', $1) AS "universe" + json_build_object('result', row_to_json("%6_universe"), 'type', $1) AS "universe" FROM ( SELECT @@ -44,37 +37,37 @@ SELECT FROM ( SELECT - coalesce(json_agg(row_to_json("%8_returning")), '[]') AS "returning" + coalesce(json_agg(row_to_json("%7_returning")), '[]') AS "returning" FROM ( SELECT - "%4_InvoiceLine"."InvoiceLineId" AS "invoice_line_id", - "%4_InvoiceLine"."Quantity" AS "quantity" + "%3_InvoiceLine"."InvoiceLineId" AS "invoice_line_id", + "%3_InvoiceLine"."Quantity" AS "quantity" FROM - "%0_generated_mutation" AS "%4_InvoiceLine" - ) AS "%8_returning" - ) AS "%8_returning" + "%0_generated_mutation" AS "%3_InvoiceLine" + ) AS "%7_returning" + ) AS "%7_returning" CROSS JOIN ( SELECT COUNT(*) AS "affected_rows" FROM ( SELECT - "%5_InvoiceLine".* + "%4_InvoiceLine".* FROM - "%0_generated_mutation" AS "%5_InvoiceLine" - ) AS "%6_InvoiceLine" - ) AS "%9_aggregates" - ) AS "%7_universe" + "%0_generated_mutation" AS "%4_InvoiceLine" + ) AS "%5_InvoiceLine" + ) AS "%8_aggregates" + ) AS "%6_universe" ) AS "%results", ( SELECT coalesce( bool_and( - "%10_delete_InvoiceLine_by_InvoiceLineId"."%check__constraint" + "%9_delete_InvoiceLine_by_InvoiceLineId"."%check__constraint" ), true ) AS "%check__constraint" FROM - "%0_generated_mutation" AS "%10_delete_InvoiceLine_by_InvoiceLineId" + "%0_generated_mutation" AS "%9_delete_InvoiceLine_by_InvoiceLineId" ) AS "%check__constraint" diff --git a/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__explain_tests__query__duplicate_filter_results.snap b/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__explain_tests__query__duplicate_filter_results.snap index 5a18435c8..85b300374 100644 --- a/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__explain_tests__query__duplicate_filter_results.snap +++ b/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__explain_tests__query__duplicate_filter_results.snap @@ -1,10 +1,12 @@ --- source: crates/tests/databases-tests/src/postgres/explain_tests.rs +assertion_line: 46 expression: result.details.query +snapshot_kind: text --- EXPLAIN SELECT - coalesce(json_agg(row_to_json("%3_universe")), '[]') AS "universe" + coalesce(json_agg(row_to_json("%2_universe")), '[]') AS "universe" FROM ( SELECT @@ -12,7 +14,7 @@ FROM FROM ( SELECT - coalesce(json_agg(row_to_json("%4_rows")), '[]') AS "rows" + coalesce(json_agg(row_to_json("%3_rows")), '[]') AS "rows" FROM ( SELECT @@ -22,32 +24,21 @@ FROM WHERE EXISTS ( SELECT - 1 + 1 AS "one" FROM - ( - SELECT - "%1_BOOLEXP_Album".* - FROM - ( - SELECT - * - FROM - "public"."Album" AS "%1_BOOLEXP_Album" - WHERE - ( - "%0_Artist"."ArtistId" = "%1_BOOLEXP_Album"."ArtistId" - ) - ) AS "%1_BOOLEXP_Album" - ) AS "%2_BOOLEXP_Album" + "public"."Album" AS "%1_Album" WHERE ( - "%2_BOOLEXP_Album"."Title" ~~ cast($1 as "pg_catalog"."varchar") + ( + "%1_Album"."Title" ~~ cast($1 as "pg_catalog"."varchar") + ) + AND ("%0_Artist"."ArtistId" = "%1_Album"."ArtistId") ) ) ORDER BY "%0_Artist"."ArtistId" ASC LIMIT 5 - ) AS "%4_rows" - ) AS "%4_rows" - ) AS "%3_universe" + ) AS "%3_rows" + ) AS "%3_rows" + ) AS "%2_universe" diff --git a/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__explain_tests__query__duplicate_filter_results_nested.snap b/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__explain_tests__query__duplicate_filter_results_nested.snap index db423a753..8cbc250a9 100644 --- a/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__explain_tests__query__duplicate_filter_results_nested.snap +++ b/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__explain_tests__query__duplicate_filter_results_nested.snap @@ -1,10 +1,12 @@ --- source: crates/tests/databases-tests/src/postgres/explain_tests.rs +assertion_line: 61 expression: result.details.query +snapshot_kind: text --- EXPLAIN SELECT - coalesce(json_agg(row_to_json("%6_universe")), '[]') AS "universe" + coalesce(json_agg(row_to_json("%4_universe")), '[]') AS "universe" FROM ( SELECT @@ -12,7 +14,7 @@ FROM FROM ( SELECT - coalesce(json_agg(row_to_json("%7_rows")), '[]') AS "rows" + coalesce(json_agg(row_to_json("%5_rows")), '[]') AS "rows" FROM ( SELECT @@ -20,64 +22,48 @@ FROM FROM "public"."Artist" AS "%0_Artist" WHERE - EXISTS ( - SELECT - 1 - FROM - ( - SELECT - "%2_BOOLEXP_Track".* - FROM - ( - SELECT - * - FROM - "public"."Album" AS "%1_BOOLEXP_Album" - WHERE - ( - "%0_Artist"."ArtistId" = "%1_BOOLEXP_Album"."ArtistId" - ) - ) AS "%1_BOOLEXP_Album" - INNER JOIN LATERAL ( - SELECT - * - FROM - "public"."Track" AS "%2_BOOLEXP_Track" - WHERE - ( - "%1_BOOLEXP_Album"."AlbumId" = "%2_BOOLEXP_Track"."AlbumId" - ) - ) AS "%2_BOOLEXP_Track" ON ('true') - ) AS "%3_BOOLEXP_Track" FULL - OUTER JOIN LATERAL ( - SELECT - "%4_BOOLEXP_Album".* - FROM - ( + ( + EXISTS ( + SELECT + 1 AS "one" + FROM + "public"."Album" AS "%1_Album" + WHERE + ( + EXISTS ( SELECT - * + 1 AS "one" FROM - "public"."Album" AS "%4_BOOLEXP_Album" + "public"."Track" AS "%2_Track" WHERE ( - "%0_Artist"."ArtistId" = "%4_BOOLEXP_Album"."ArtistId" + ( + "%2_Track"."Name" ~~ cast($1 as "pg_catalog"."varchar") + ) + AND ("%1_Album"."AlbumId" = "%2_Track"."AlbumId") ) - ) AS "%4_BOOLEXP_Album" - ) AS "%5_BOOLEXP_Album" ON ('true') - WHERE - ( - ( - "%3_BOOLEXP_Track"."Name" ~~ cast($1 as "pg_catalog"."varchar") + ) + AND ("%0_Artist"."ArtistId" = "%1_Album"."ArtistId") ) - OR ( - "%5_BOOLEXP_Album"."Title" ~~ cast($2 as "pg_catalog"."varchar") + ) + OR EXISTS ( + SELECT + 1 AS "one" + FROM + "public"."Album" AS "%3_Album" + WHERE + ( + ( + "%3_Album"."Title" ~~ cast($2 as "pg_catalog"."varchar") + ) + AND ("%0_Artist"."ArtistId" = "%3_Album"."ArtistId") ) - ) + ) ) ORDER BY "%0_Artist"."ArtistId" ASC LIMIT 5 - ) AS "%7_rows" - ) AS "%7_rows" - ) AS "%6_universe" + ) AS "%5_rows" + ) AS "%5_rows" + ) AS "%4_universe" diff --git a/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__schema_tests__schema_test__get_schema.snap b/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__schema_tests__schema_test__get_schema.snap index 83f027d25..231f0b7ca 100644 --- a/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__schema_tests__schema_test__get_schema.snap +++ b/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__schema_tests__schema_test__get_schema.snap @@ -11,22 +11,10 @@ snapshot_kind: text }, "aggregate_functions": { "max": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "text" - } - } + "type": "max" }, "min": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "text" - } - } + "type": "min" } }, "comparison_operators": { @@ -177,6 +165,7 @@ snapshot_kind: text }, "aggregate_functions": { "bool_and": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -186,6 +175,7 @@ snapshot_kind: text } }, "bool_or": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -195,6 +185,7 @@ snapshot_kind: text } }, "every": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -260,22 +251,10 @@ snapshot_kind: text }, "aggregate_functions": { "max": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "card_suit" - } - } + "type": "max" }, "min": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "card_suit" - } - } + "type": "min" } }, "comparison_operators": { @@ -328,22 +307,10 @@ snapshot_kind: text }, "aggregate_functions": { "max": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "text" - } - } + "type": "max" }, "min": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "text" - } - } + "type": "min" } }, "comparison_operators": { @@ -489,24 +456,15 @@ snapshot_kind: text } }, "cidr": { + "representation": { + "type": "json" + }, "aggregate_functions": { "max": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "inet" - } - } + "type": "max" }, "min": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "inet" - } - } + "type": "min" } }, "comparison_operators": { @@ -601,22 +559,10 @@ snapshot_kind: text }, "aggregate_functions": { "max": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "date" - } - } + "type": "max" }, "min": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "date" - } - } + "type": "min" } }, "comparison_operators": { @@ -669,6 +615,7 @@ snapshot_kind: text }, "aggregate_functions": { "avg": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -678,6 +625,7 @@ snapshot_kind: text } }, "bit_and": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -687,6 +635,7 @@ snapshot_kind: text } }, "bit_or": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -696,6 +645,7 @@ snapshot_kind: text } }, "bit_xor": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -705,24 +655,13 @@ snapshot_kind: text } }, "max": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "int4" - } - } + "type": "max" }, "min": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "int4" - } - } + "type": "min" }, "stddev": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -732,6 +671,7 @@ snapshot_kind: text } }, "stddev_pop": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -741,6 +681,7 @@ snapshot_kind: text } }, "stddev_samp": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -750,15 +691,11 @@ snapshot_kind: text } }, "sum": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "int8" - } - } + "type": "sum", + "result_type": "int8" }, "var_pop": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -768,6 +705,7 @@ snapshot_kind: text } }, "var_samp": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -777,6 +715,7 @@ snapshot_kind: text } }, "variance": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -836,33 +775,17 @@ snapshot_kind: text }, "aggregate_functions": { "avg": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "float8" - } - } + "type": "average", + "result_type": "float8" }, "max": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "float4" - } - } + "type": "max" }, "min": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "float4" - } - } + "type": "min" }, "stddev": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -872,6 +795,7 @@ snapshot_kind: text } }, "stddev_pop": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -881,6 +805,7 @@ snapshot_kind: text } }, "stddev_samp": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -890,6 +815,7 @@ snapshot_kind: text } }, "sum": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -899,6 +825,7 @@ snapshot_kind: text } }, "var_pop": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -908,6 +835,7 @@ snapshot_kind: text } }, "var_samp": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -917,6 +845,7 @@ snapshot_kind: text } }, "variance": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -976,33 +905,17 @@ snapshot_kind: text }, "aggregate_functions": { "avg": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "float8" - } - } + "type": "average", + "result_type": "float8" }, "max": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "float8" - } - } + "type": "max" }, "min": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "float8" - } - } + "type": "min" }, "stddev": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1012,6 +925,7 @@ snapshot_kind: text } }, "stddev_pop": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1021,6 +935,7 @@ snapshot_kind: text } }, "stddev_samp": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1030,15 +945,11 @@ snapshot_kind: text } }, "sum": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "float8" - } - } + "type": "sum", + "result_type": "float8" }, "var_pop": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1048,6 +959,7 @@ snapshot_kind: text } }, "var_samp": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1057,6 +969,7 @@ snapshot_kind: text } }, "variance": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1111,24 +1024,15 @@ snapshot_kind: text } }, "inet": { + "representation": { + "type": "json" + }, "aggregate_functions": { "max": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "inet" - } - } + "type": "max" }, "min": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "inet" - } - } + "type": "min" } }, "comparison_operators": { @@ -1223,6 +1127,7 @@ snapshot_kind: text }, "aggregate_functions": { "avg": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1232,6 +1137,7 @@ snapshot_kind: text } }, "bit_and": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1241,6 +1147,7 @@ snapshot_kind: text } }, "bit_or": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1250,6 +1157,7 @@ snapshot_kind: text } }, "bit_xor": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1259,24 +1167,13 @@ snapshot_kind: text } }, "max": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "int2" - } - } + "type": "max" }, "min": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "int2" - } - } + "type": "min" }, "stddev": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1286,6 +1183,7 @@ snapshot_kind: text } }, "stddev_pop": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1295,6 +1193,7 @@ snapshot_kind: text } }, "stddev_samp": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1304,15 +1203,11 @@ snapshot_kind: text } }, "sum": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "int8" - } - } + "type": "sum", + "result_type": "int8" }, "var_pop": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1322,6 +1217,7 @@ snapshot_kind: text } }, "var_samp": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1331,6 +1227,7 @@ snapshot_kind: text } }, "variance": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1390,6 +1287,7 @@ snapshot_kind: text }, "aggregate_functions": { "avg": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1399,6 +1297,7 @@ snapshot_kind: text } }, "bit_and": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1408,6 +1307,7 @@ snapshot_kind: text } }, "bit_or": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1417,6 +1317,7 @@ snapshot_kind: text } }, "bit_xor": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1426,24 +1327,13 @@ snapshot_kind: text } }, "max": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "int4" - } - } + "type": "max" }, "min": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "int4" - } - } + "type": "min" }, "stddev": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1453,6 +1343,7 @@ snapshot_kind: text } }, "stddev_pop": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1462,6 +1353,7 @@ snapshot_kind: text } }, "stddev_samp": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1471,15 +1363,11 @@ snapshot_kind: text } }, "sum": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "int8" - } - } + "type": "sum", + "result_type": "int8" }, "var_pop": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1489,6 +1377,7 @@ snapshot_kind: text } }, "var_samp": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1498,6 +1387,7 @@ snapshot_kind: text } }, "variance": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1557,6 +1447,7 @@ snapshot_kind: text }, "aggregate_functions": { "avg": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1566,6 +1457,7 @@ snapshot_kind: text } }, "bit_and": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1575,6 +1467,7 @@ snapshot_kind: text } }, "bit_or": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1584,6 +1477,7 @@ snapshot_kind: text } }, "bit_xor": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1593,24 +1487,13 @@ snapshot_kind: text } }, "max": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "int8" - } - } + "type": "max" }, "min": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "int8" - } - } + "type": "min" }, "stddev": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1620,6 +1503,7 @@ snapshot_kind: text } }, "stddev_pop": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1629,6 +1513,7 @@ snapshot_kind: text } }, "stddev_samp": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1638,6 +1523,7 @@ snapshot_kind: text } }, "sum": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1647,6 +1533,7 @@ snapshot_kind: text } }, "var_pop": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1656,6 +1543,7 @@ snapshot_kind: text } }, "var_samp": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1665,6 +1553,7 @@ snapshot_kind: text } }, "variance": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1719,8 +1608,12 @@ snapshot_kind: text } }, "interval": { + "representation": { + "type": "json" + }, "aggregate_functions": { "avg": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1730,24 +1623,13 @@ snapshot_kind: text } }, "max": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "interval" - } - } + "type": "max" }, "min": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "interval" - } - } + "type": "min" }, "sum": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1807,6 +1689,7 @@ snapshot_kind: text }, "aggregate_functions": { "avg": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1816,24 +1699,13 @@ snapshot_kind: text } }, "max": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "numeric" - } - } + "type": "max" }, "min": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "numeric" - } - } + "type": "min" }, "stddev": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1843,6 +1715,7 @@ snapshot_kind: text } }, "stddev_pop": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1852,6 +1725,7 @@ snapshot_kind: text } }, "stddev_samp": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1861,6 +1735,7 @@ snapshot_kind: text } }, "sum": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1870,6 +1745,7 @@ snapshot_kind: text } }, "var_pop": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1879,6 +1755,7 @@ snapshot_kind: text } }, "var_samp": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1888,6 +1765,7 @@ snapshot_kind: text } }, "variance": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -1947,22 +1825,10 @@ snapshot_kind: text }, "aggregate_functions": { "max": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "text" - } - } + "type": "max" }, "min": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "text" - } - } + "type": "min" } }, "comparison_operators": { @@ -2113,6 +1979,7 @@ snapshot_kind: text }, "aggregate_functions": { "avg": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -2122,24 +1989,13 @@ snapshot_kind: text } }, "max": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "time" - } - } + "type": "max" }, "min": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "time" - } - } + "type": "min" }, "sum": { + "type": "custom", "result_type": { "type": "nullable", "underlying_type": { @@ -2199,22 +2055,10 @@ snapshot_kind: text }, "aggregate_functions": { "max": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "timestamp" - } - } + "type": "max" }, "min": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "timestamp" - } - } + "type": "min" } }, "comparison_operators": { @@ -2267,22 +2111,10 @@ snapshot_kind: text }, "aggregate_functions": { "max": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "timestamptz" - } - } + "type": "max" }, "min": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "timestamptz" - } - } + "type": "min" } }, "comparison_operators": { @@ -2335,22 +2167,10 @@ snapshot_kind: text }, "aggregate_functions": { "max": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "timetz" - } - } + "type": "max" }, "min": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "timetz" - } - } + "type": "min" } }, "comparison_operators": { @@ -2452,22 +2272,10 @@ snapshot_kind: text }, "aggregate_functions": { "max": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "text" - } - } + "type": "max" }, "min": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "text" - } - } + "type": "min" } }, "comparison_operators": { @@ -2638,6 +2446,16 @@ snapshot_kind: text "name": "varchar" } } + }, + "foreign_keys": { + "FK_AlbumArtistId": { + "column_mapping": { + "ArtistId": [ + "ArtistId" + ] + }, + "foreign_collection": "Artist" + } } }, "Artist": { @@ -2660,7 +2478,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "Customer": { "description": "The record of all customers", @@ -2773,6 +2592,16 @@ snapshot_kind: text } } } + }, + "foreign_keys": { + "FK_CustomerSupportRepId": { + "column_mapping": { + "SupportRepId": [ + "EmployeeId" + ] + }, + "foreign_collection": "Employee" + } } }, "Employee": { @@ -2903,6 +2732,16 @@ snapshot_kind: text } } } + }, + "foreign_keys": { + "FK_EmployeeReportsTo": { + "column_mapping": { + "ReportsTo": [ + "EmployeeId" + ] + }, + "foreign_collection": "Employee" + } } }, "Genre": { @@ -2922,7 +2761,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "Invoice": { "fields": { @@ -2995,6 +2835,16 @@ snapshot_kind: text "name": "numeric" } } + }, + "foreign_keys": { + "FK_InvoiceCustomerId": { + "column_mapping": { + "CustomerId": [ + "CustomerId" + ] + }, + "foreign_collection": "Customer" + } } }, "InvoiceLine": { @@ -3029,6 +2879,24 @@ snapshot_kind: text "name": "numeric" } } + }, + "foreign_keys": { + "FK_InvoiceLineInvoiceId": { + "column_mapping": { + "InvoiceId": [ + "InvoiceId" + ] + }, + "foreign_collection": "Invoice" + }, + "FK_InvoiceLineTrackId": { + "column_mapping": { + "TrackId": [ + "TrackId" + ] + }, + "foreign_collection": "Track" + } } }, "MediaType": { @@ -3048,7 +2916,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "Playlist": { "fields": { @@ -3067,7 +2936,8 @@ snapshot_kind: text "name": "int4" } } - } + }, + "foreign_keys": {} }, "PlaylistTrack": { "fields": { @@ -3083,6 +2953,24 @@ snapshot_kind: text "name": "int4" } } + }, + "foreign_keys": { + "FK_PlaylistTrackPlaylistId": { + "column_mapping": { + "PlaylistId": [ + "PlaylistId" + ] + }, + "foreign_collection": "Playlist" + }, + "FK_PlaylistTrackTrackId": { + "column_mapping": { + "TrackId": [ + "TrackId" + ] + }, + "foreign_collection": "Track" + } } }, "Track": { @@ -3153,6 +3041,32 @@ snapshot_kind: text "name": "numeric" } } + }, + "foreign_keys": { + "FK_TrackAlbumId": { + "column_mapping": { + "AlbumId": [ + "AlbumId" + ] + }, + "foreign_collection": "Album" + }, + "FK_TrackGenreId": { + "column_mapping": { + "GenreId": [ + "GenreId" + ] + }, + "foreign_collection": "Genre" + }, + "FK_TrackMediaTypeId": { + "column_mapping": { + "MediaTypeId": [ + "MediaTypeId" + ] + }, + "foreign_collection": "MediaType" + } } }, "address_identity_function": { @@ -3167,7 +3081,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "album_by_title": { "fields": { @@ -3198,7 +3113,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "array_reverse": { "description": "A native query used to test support for arrays as inputs", @@ -3219,7 +3135,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "array_series": { "description": "A native query used to test support for arrays", @@ -3248,7 +3165,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "artist": { "fields": { @@ -3270,7 +3188,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "artist_below_id": { "fields": { @@ -3292,7 +3211,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "chara": { "fields": { @@ -3314,7 +3234,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "characters": { "fields": { @@ -3342,7 +3263,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "committee": { "fields": { @@ -3370,7 +3292,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "count_elements": { "description": "A native query used to test support array-valued variables", @@ -3384,7 +3307,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "custom_defaults": { "fields": { @@ -3424,7 +3348,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "custom_dog": { "fields": { @@ -3470,7 +3395,8 @@ snapshot_kind: text "name": "text" } } - } + }, + "foreign_keys": {} }, "custom_test_cidr": { "fields": { @@ -3492,7 +3418,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "deck_of_cards": { "fields": { @@ -3508,7 +3435,8 @@ snapshot_kind: text "name": "card_suit" } } - } + }, + "foreign_keys": {} }, "delete_Album_by_AlbumId_response": { "description": "Responses from the 'delete_Album_by_AlbumId' procedure", @@ -3530,7 +3458,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "delete_Artist_by_ArtistId_response": { "description": "Responses from the 'delete_Artist_by_ArtistId' procedure", @@ -3552,7 +3481,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "delete_Customer_by_CustomerId_response": { "description": "Responses from the 'delete_Customer_by_CustomerId' procedure", @@ -3574,7 +3504,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "delete_Employee_by_EmployeeId_response": { "description": "Responses from the 'delete_Employee_by_EmployeeId' procedure", @@ -3596,7 +3527,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "delete_Genre_by_GenreId_response": { "description": "Responses from the 'delete_Genre_by_GenreId' procedure", @@ -3618,7 +3550,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "delete_InvoiceLine_by_InvoiceLineId_response": { "description": "Responses from the 'delete_InvoiceLine_by_InvoiceLineId' procedure", @@ -3640,7 +3573,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "delete_Invoice_by_InvoiceId_response": { "description": "Responses from the 'delete_Invoice_by_InvoiceId' procedure", @@ -3662,7 +3596,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "delete_MediaType_by_MediaTypeId_response": { "description": "Responses from the 'delete_MediaType_by_MediaTypeId' procedure", @@ -3684,7 +3619,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "delete_PlaylistTrack_by_PlaylistId_and_TrackId_response": { "description": "Responses from the 'delete_PlaylistTrack_by_PlaylistId_and_TrackId' procedure", @@ -3706,7 +3642,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "delete_Playlist_by_PlaylistId_response": { "description": "Responses from the 'delete_Playlist_by_PlaylistId' procedure", @@ -3728,7 +3665,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "delete_Track_by_TrackId_response": { "description": "Responses from the 'delete_Track_by_TrackId' procedure", @@ -3750,7 +3688,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "delete_custom_defaults_by_id_response": { "description": "Responses from the 'delete_custom_defaults_by_id' procedure", @@ -3772,7 +3711,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "delete_custom_dog_by_id_response": { "description": "Responses from the 'delete_custom_dog_by_id' procedure", @@ -3794,7 +3734,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "delete_institution_institution_by_id_response": { "description": "Responses from the 'delete_institution_institution_by_id' procedure", @@ -3816,7 +3757,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "delete_playlist_track": { "fields": { @@ -3838,7 +3780,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "delete_playlist_track_response": { "description": "Responses from the 'delete_playlist_track' procedure", @@ -3860,7 +3803,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "delete_spatial_ref_sys_by_srid_response": { "description": "Responses from the 'delete_spatial_ref_sys_by_srid' procedure", @@ -3882,7 +3826,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "delete_topology_layer_by_feature_column_and_schema_name_and_table_name_response": { "description": "Responses from the 'delete_topology_layer_by_feature_column_and_schema_name_and_table_name' procedure", @@ -3904,7 +3849,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "delete_topology_layer_by_layer_id_and_topology_id_response": { "description": "Responses from the 'delete_topology_layer_by_layer_id_and_topology_id' procedure", @@ -3926,7 +3872,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "delete_topology_topology_by_id_response": { "description": "Responses from the 'delete_topology_topology_by_id' procedure", @@ -3948,7 +3895,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "delete_topology_topology_by_name_response": { "description": "Responses from the 'delete_topology_topology_by_name' procedure", @@ -3970,7 +3918,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "discoverable_types": { "fields": { @@ -3983,7 +3932,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "discoverable_types_root_occurrence": { "fields": { @@ -3996,7 +3946,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "even_numbers": { "fields": { @@ -4006,7 +3957,8 @@ snapshot_kind: text "name": "even_number" } } - } + }, + "foreign_keys": {} }, "group_leader": { "fields": { @@ -4037,7 +3989,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "insert_Album_object": { "fields": { @@ -4062,7 +4015,8 @@ snapshot_kind: text "name": "varchar" } } - } + }, + "foreign_keys": {} }, "insert_Album_response": { "description": "Responses from the 'insert_Album' procedure", @@ -4084,7 +4038,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "insert_Artist_object": { "fields": { @@ -4105,7 +4060,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "insert_Artist_response": { "description": "Responses from the 'insert_Artist' procedure", @@ -4127,7 +4083,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "insert_Customer_object": { "fields": { @@ -4239,7 +4196,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "insert_Customer_response": { "description": "Responses from the 'insert_Customer' procedure", @@ -4261,7 +4219,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "insert_Employee_object": { "fields": { @@ -4391,7 +4350,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "insert_Employee_response": { "description": "Responses from the 'insert_Employee' procedure", @@ -4413,7 +4373,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "insert_Genre_object": { "fields": { @@ -4432,7 +4393,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "insert_Genre_response": { "description": "Responses from the 'insert_Genre' procedure", @@ -4454,7 +4416,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "insert_InvoiceLine_object": { "fields": { @@ -4488,7 +4451,8 @@ snapshot_kind: text "name": "numeric" } } - } + }, + "foreign_keys": {} }, "insert_InvoiceLine_response": { "description": "Responses from the 'insert_InvoiceLine' procedure", @@ -4510,7 +4474,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "insert_Invoice_object": { "fields": { @@ -4583,7 +4548,8 @@ snapshot_kind: text "name": "numeric" } } - } + }, + "foreign_keys": {} }, "insert_Invoice_response": { "description": "Responses from the 'insert_Invoice' procedure", @@ -4605,7 +4571,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "insert_MediaType_object": { "fields": { @@ -4624,7 +4591,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "insert_MediaType_response": { "description": "Responses from the 'insert_MediaType' procedure", @@ -4646,7 +4614,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "insert_PlaylistTrack_object": { "fields": { @@ -4662,7 +4631,8 @@ snapshot_kind: text "name": "int4" } } - } + }, + "foreign_keys": {} }, "insert_PlaylistTrack_response": { "description": "Responses from the 'insert_PlaylistTrack' procedure", @@ -4684,7 +4654,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "insert_Playlist_object": { "fields": { @@ -4703,7 +4674,8 @@ snapshot_kind: text "name": "int4" } } - } + }, + "foreign_keys": {} }, "insert_Playlist_response": { "description": "Responses from the 'insert_Playlist' procedure", @@ -4725,7 +4697,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "insert_Track_object": { "fields": { @@ -4795,7 +4768,8 @@ snapshot_kind: text "name": "numeric" } } - } + }, + "foreign_keys": {} }, "insert_Track_response": { "description": "Responses from the 'insert_Track' procedure", @@ -4817,7 +4791,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "insert_album": { "fields": { @@ -4848,7 +4823,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "insert_album_response": { "description": "Responses from the 'insert_album' procedure", @@ -4870,7 +4846,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "insert_artist": { "fields": { @@ -4892,7 +4869,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "insert_artist_response": { "description": "Responses from the 'insert_artist' procedure", @@ -4914,7 +4892,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "insert_custom_defaults_object": { "fields": { @@ -4945,7 +4924,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "insert_custom_defaults_response": { "description": "Responses from the 'insert_custom_defaults' procedure", @@ -4967,7 +4947,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "insert_custom_dog_object": { "fields": { @@ -5001,7 +4982,8 @@ snapshot_kind: text "name": "text" } } - } + }, + "foreign_keys": {} }, "insert_custom_dog_response": { "description": "Responses from the 'insert_custom_dog' procedure", @@ -5023,7 +5005,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "insert_custom_test_cidr_object": { "fields": { @@ -5045,7 +5028,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "insert_custom_test_cidr_response": { "description": "Responses from the 'insert_custom_test_cidr' procedure", @@ -5067,7 +5051,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "insert_deck_of_cards_object": { "fields": { @@ -5083,7 +5068,8 @@ snapshot_kind: text "name": "card_suit" } } - } + }, + "foreign_keys": {} }, "insert_deck_of_cards_response": { "description": "Responses from the 'insert_deck_of_cards' procedure", @@ -5105,7 +5091,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "insert_discoverable_types_root_occurrence_object": { "fields": { @@ -5118,7 +5105,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "insert_discoverable_types_root_occurrence_response": { "description": "Responses from the 'insert_discoverable_types_root_occurrence' procedure", @@ -5140,7 +5128,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "insert_even_numbers_object": { "fields": { @@ -5150,7 +5139,8 @@ snapshot_kind: text "name": "even_number" } } - } + }, + "foreign_keys": {} }, "insert_even_numbers_response": { "description": "Responses from the 'insert_even_numbers' procedure", @@ -5172,7 +5162,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "insert_group_leader_object": { "fields": { @@ -5203,7 +5194,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "insert_group_leader_response": { "description": "Responses from the 'insert_group_leader' procedure", @@ -5225,7 +5217,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "insert_institution_institution_object": { "fields": { @@ -5292,7 +5285,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "insert_institution_institution_response": { "description": "Responses from the 'insert_institution_institution' procedure", @@ -5314,7 +5308,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "insert_phone_numbers_object": { "fields": { @@ -5324,7 +5319,8 @@ snapshot_kind: text "name": "Phone" } } - } + }, + "foreign_keys": {} }, "insert_phone_numbers_response": { "description": "Responses from the 'insert_phone_numbers' procedure", @@ -5346,7 +5342,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "insert_spatial_ref_sys_object": { "fields": { @@ -5392,7 +5389,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "insert_spatial_ref_sys_response": { "description": "Responses from the 'insert_spatial_ref_sys' procedure", @@ -5414,7 +5412,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "insert_text_table_object": { "fields": { @@ -5436,7 +5435,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "insert_text_table_response": { "description": "Responses from the 'insert_text_table' procedure", @@ -5458,7 +5458,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "insert_topology_layer_object": { "fields": { @@ -5516,7 +5517,8 @@ snapshot_kind: text "name": "int4" } } - } + }, + "foreign_keys": {} }, "insert_topology_layer_response": { "description": "Responses from the 'insert_topology_layer' procedure", @@ -5538,7 +5540,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "insert_topology_topology_object": { "fields": { @@ -5578,7 +5581,8 @@ snapshot_kind: text "name": "int4" } } - } + }, + "foreign_keys": {} }, "insert_topology_topology_response": { "description": "Responses from the 'insert_topology_topology' procedure", @@ -5600,7 +5604,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "institution_country": { "fields": { @@ -5622,7 +5627,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "institution_institution": { "fields": { @@ -5689,7 +5695,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "institution_institution_songs": { "fields": { @@ -5711,7 +5718,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "institution_location": { "fields": { @@ -5748,7 +5756,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "institution_staff": { "fields": { @@ -5794,7 +5803,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "make_person": { "description": "A native query used to test support for composite types", @@ -5808,7 +5818,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "organization": { "fields": { @@ -5836,7 +5847,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "organization_identity_function": { "description": "A native query used to test support for composite types", @@ -5850,7 +5862,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "person": { "fields": { @@ -5872,7 +5885,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "person_address": { "description": "The address of a person, obviously", @@ -5897,7 +5911,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "person_name": { "description": "The name of a person, obviously", @@ -5922,7 +5937,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "phone_numbers": { "fields": { @@ -5932,7 +5948,8 @@ snapshot_kind: text "name": "Phone" } } - } + }, + "foreign_keys": {} }, "spatial_ref_sys": { "fields": { @@ -5978,7 +5995,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "summarize_organizations": { "description": "A native query used to test support array-valued variables", @@ -5992,7 +6010,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "text_table": { "fields": { @@ -6014,7 +6033,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "topology_layer": { "fields": { @@ -6069,6 +6089,16 @@ snapshot_kind: text "name": "int4" } } + }, + "foreign_keys": { + "layer_topology_id_fkey": { + "column_mapping": { + "topology_id": [ + "id" + ] + }, + "foreign_collection": "topology_topology" + } } }, "topology_topology": { @@ -6103,7 +6133,8 @@ snapshot_kind: text "name": "int4" } } - } + }, + "foreign_keys": {} }, "update_Album_by_AlbumId_response": { "description": "Responses from the 'update_Album_by_AlbumId' procedure", @@ -6125,7 +6156,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_Album_by_AlbumId_update_columns": { "description": "Update the columns of the 'Album' collection", @@ -6160,7 +6192,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_Artist_by_ArtistId_response": { "description": "Responses from the 'update_Artist_by_ArtistId' procedure", @@ -6182,7 +6215,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_Artist_by_ArtistId_update_columns": { "description": "Update the columns of the 'Artist' collection", @@ -6207,7 +6241,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_Customer_by_CustomerId_response": { "description": "Responses from the 'update_Customer_by_CustomerId' procedure", @@ -6229,7 +6264,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_Customer_by_CustomerId_update_columns": { "description": "Update the columns of the 'Customer' collection", @@ -6364,7 +6400,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_Employee_by_EmployeeId_response": { "description": "Responses from the 'update_Employee_by_EmployeeId' procedure", @@ -6386,7 +6423,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_Employee_by_EmployeeId_update_columns": { "description": "Update the columns of the 'Employee' collection", @@ -6541,7 +6579,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_Genre_by_GenreId_response": { "description": "Responses from the 'update_Genre_by_GenreId' procedure", @@ -6563,7 +6602,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_Genre_by_GenreId_update_columns": { "description": "Update the columns of the 'Genre' collection", @@ -6588,7 +6628,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_InvoiceLine_by_InvoiceLineId_response": { "description": "Responses from the 'update_InvoiceLine_by_InvoiceLineId' procedure", @@ -6610,7 +6651,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_InvoiceLine_by_InvoiceLineId_update_columns": { "description": "Update the columns of the 'InvoiceLine' collection", @@ -6665,7 +6707,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_Invoice_by_InvoiceId_response": { "description": "Responses from the 'update_Invoice_by_InvoiceId' procedure", @@ -6687,7 +6730,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_Invoice_by_InvoiceId_update_columns": { "description": "Update the columns of the 'Invoice' collection", @@ -6782,7 +6826,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_MediaType_by_MediaTypeId_response": { "description": "Responses from the 'update_MediaType_by_MediaTypeId' procedure", @@ -6804,7 +6849,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_MediaType_by_MediaTypeId_update_columns": { "description": "Update the columns of the 'MediaType' collection", @@ -6829,7 +6875,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_PlaylistTrack_by_PlaylistId_and_TrackId_response": { "description": "Responses from the 'update_PlaylistTrack_by_PlaylistId_and_TrackId' procedure", @@ -6851,7 +6898,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_PlaylistTrack_by_PlaylistId_and_TrackId_update_columns": { "description": "Update the columns of the 'PlaylistTrack' collection", @@ -6876,7 +6924,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_Playlist_by_PlaylistId_response": { "description": "Responses from the 'update_Playlist_by_PlaylistId' procedure", @@ -6898,7 +6947,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_Playlist_by_PlaylistId_update_columns": { "description": "Update the columns of the 'Playlist' collection", @@ -6923,7 +6973,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_Track_by_TrackId_response": { "description": "Responses from the 'update_Track_by_TrackId' procedure", @@ -6945,7 +6996,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_Track_by_TrackId_update_columns": { "description": "Update the columns of the 'Track' collection", @@ -7040,7 +7092,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_column_Album_AlbumId": { "description": "Update the 'AlbumId' column in the 'Album' collection", @@ -7052,7 +7105,8 @@ snapshot_kind: text "name": "int4" } } - } + }, + "foreign_keys": {} }, "update_column_Album_ArtistId": { "description": "Update the 'ArtistId' column in the 'Album' collection", @@ -7064,7 +7118,8 @@ snapshot_kind: text "name": "int4" } } - } + }, + "foreign_keys": {} }, "update_column_Album_Title": { "description": "Update the 'Title' column in the 'Album' collection", @@ -7076,7 +7131,8 @@ snapshot_kind: text "name": "varchar" } } - } + }, + "foreign_keys": {} }, "update_column_Artist_ArtistId": { "description": "Update the 'ArtistId' column in the 'Artist' collection", @@ -7088,7 +7144,8 @@ snapshot_kind: text "name": "int4" } } - } + }, + "foreign_keys": {} }, "update_column_Artist_Name": { "description": "Update the 'Name' column in the 'Artist' collection", @@ -7103,7 +7160,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_column_Customer_Address": { "description": "Update the 'Address' column in the 'Customer' collection", @@ -7118,7 +7176,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_column_Customer_City": { "description": "Update the 'City' column in the 'Customer' collection", @@ -7133,7 +7192,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_column_Customer_Company": { "description": "Update the 'Company' column in the 'Customer' collection", @@ -7148,7 +7208,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_column_Customer_Country": { "description": "Update the 'Country' column in the 'Customer' collection", @@ -7163,7 +7224,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_column_Customer_CustomerId": { "description": "Update the 'CustomerId' column in the 'Customer' collection", @@ -7175,7 +7237,8 @@ snapshot_kind: text "name": "int4" } } - } + }, + "foreign_keys": {} }, "update_column_Customer_Email": { "description": "Update the 'Email' column in the 'Customer' collection", @@ -7187,7 +7250,8 @@ snapshot_kind: text "name": "varchar" } } - } + }, + "foreign_keys": {} }, "update_column_Customer_Fax": { "description": "Update the 'Fax' column in the 'Customer' collection", @@ -7202,7 +7266,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_column_Customer_FirstName": { "description": "Update the 'FirstName' column in the 'Customer' collection", @@ -7214,7 +7279,8 @@ snapshot_kind: text "name": "varchar" } } - } + }, + "foreign_keys": {} }, "update_column_Customer_LastName": { "description": "Update the 'LastName' column in the 'Customer' collection", @@ -7226,7 +7292,8 @@ snapshot_kind: text "name": "varchar" } } - } + }, + "foreign_keys": {} }, "update_column_Customer_Phone": { "description": "Update the 'Phone' column in the 'Customer' collection", @@ -7241,7 +7308,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_column_Customer_PostalCode": { "description": "Update the 'PostalCode' column in the 'Customer' collection", @@ -7256,7 +7324,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_column_Customer_State": { "description": "Update the 'State' column in the 'Customer' collection", @@ -7271,7 +7340,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_column_Customer_SupportRepId": { "description": "Update the 'SupportRepId' column in the 'Customer' collection", @@ -7286,7 +7356,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_column_Employee_Address": { "description": "Update the 'Address' column in the 'Employee' collection", @@ -7301,7 +7372,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_column_Employee_BirthDate": { "description": "Update the 'BirthDate' column in the 'Employee' collection", @@ -7316,7 +7388,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_column_Employee_City": { "description": "Update the 'City' column in the 'Employee' collection", @@ -7331,7 +7404,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_column_Employee_Country": { "description": "Update the 'Country' column in the 'Employee' collection", @@ -7346,7 +7420,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_column_Employee_Email": { "description": "Update the 'Email' column in the 'Employee' collection", @@ -7361,7 +7436,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_column_Employee_EmployeeId": { "description": "Update the 'EmployeeId' column in the 'Employee' collection", @@ -7373,7 +7449,8 @@ snapshot_kind: text "name": "int4" } } - } + }, + "foreign_keys": {} }, "update_column_Employee_Fax": { "description": "Update the 'Fax' column in the 'Employee' collection", @@ -7388,7 +7465,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_column_Employee_FirstName": { "description": "Update the 'FirstName' column in the 'Employee' collection", @@ -7400,7 +7478,8 @@ snapshot_kind: text "name": "varchar" } } - } + }, + "foreign_keys": {} }, "update_column_Employee_HireDate": { "description": "Update the 'HireDate' column in the 'Employee' collection", @@ -7415,7 +7494,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_column_Employee_LastName": { "description": "Update the 'LastName' column in the 'Employee' collection", @@ -7427,7 +7507,8 @@ snapshot_kind: text "name": "varchar" } } - } + }, + "foreign_keys": {} }, "update_column_Employee_Phone": { "description": "Update the 'Phone' column in the 'Employee' collection", @@ -7442,7 +7523,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_column_Employee_PostalCode": { "description": "Update the 'PostalCode' column in the 'Employee' collection", @@ -7457,7 +7539,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_column_Employee_ReportsTo": { "description": "Update the 'ReportsTo' column in the 'Employee' collection", @@ -7472,7 +7555,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_column_Employee_State": { "description": "Update the 'State' column in the 'Employee' collection", @@ -7487,7 +7571,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_column_Employee_Title": { "description": "Update the 'Title' column in the 'Employee' collection", @@ -7502,7 +7587,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_column_Genre_GenreId": { "description": "Update the 'GenreId' column in the 'Genre' collection", @@ -7514,7 +7600,8 @@ snapshot_kind: text "name": "int4" } } - } + }, + "foreign_keys": {} }, "update_column_Genre_Name": { "description": "Update the 'Name' column in the 'Genre' collection", @@ -7529,7 +7616,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_column_InvoiceLine_InvoiceId": { "description": "Update the 'InvoiceId' column in the 'InvoiceLine' collection", @@ -7541,7 +7629,8 @@ snapshot_kind: text "name": "int4" } } - } + }, + "foreign_keys": {} }, "update_column_InvoiceLine_InvoiceLineId": { "description": "Update the 'InvoiceLineId' column in the 'InvoiceLine' collection", @@ -7553,7 +7642,8 @@ snapshot_kind: text "name": "int4" } } - } + }, + "foreign_keys": {} }, "update_column_InvoiceLine_Quantity": { "description": "Update the 'Quantity' column in the 'InvoiceLine' collection", @@ -7565,7 +7655,8 @@ snapshot_kind: text "name": "int4" } } - } + }, + "foreign_keys": {} }, "update_column_InvoiceLine_TrackId": { "description": "Update the 'TrackId' column in the 'InvoiceLine' collection", @@ -7577,7 +7668,8 @@ snapshot_kind: text "name": "int4" } } - } + }, + "foreign_keys": {} }, "update_column_InvoiceLine_UnitPrice": { "description": "Update the 'UnitPrice' column in the 'InvoiceLine' collection", @@ -7589,7 +7681,8 @@ snapshot_kind: text "name": "numeric" } } - } + }, + "foreign_keys": {} }, "update_column_Invoice_BillingAddress": { "description": "Update the 'BillingAddress' column in the 'Invoice' collection", @@ -7604,7 +7697,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_column_Invoice_BillingCity": { "description": "Update the 'BillingCity' column in the 'Invoice' collection", @@ -7619,7 +7713,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_column_Invoice_BillingCountry": { "description": "Update the 'BillingCountry' column in the 'Invoice' collection", @@ -7634,7 +7729,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_column_Invoice_BillingPostalCode": { "description": "Update the 'BillingPostalCode' column in the 'Invoice' collection", @@ -7649,7 +7745,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_column_Invoice_BillingState": { "description": "Update the 'BillingState' column in the 'Invoice' collection", @@ -7664,7 +7761,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_column_Invoice_CustomerId": { "description": "Update the 'CustomerId' column in the 'Invoice' collection", @@ -7676,7 +7774,8 @@ snapshot_kind: text "name": "int4" } } - } + }, + "foreign_keys": {} }, "update_column_Invoice_InvoiceDate": { "description": "Update the 'InvoiceDate' column in the 'Invoice' collection", @@ -7688,7 +7787,8 @@ snapshot_kind: text "name": "timestamp" } } - } + }, + "foreign_keys": {} }, "update_column_Invoice_InvoiceId": { "description": "Update the 'InvoiceId' column in the 'Invoice' collection", @@ -7700,7 +7800,8 @@ snapshot_kind: text "name": "int4" } } - } + }, + "foreign_keys": {} }, "update_column_Invoice_Total": { "description": "Update the 'Total' column in the 'Invoice' collection", @@ -7712,7 +7813,8 @@ snapshot_kind: text "name": "numeric" } } - } + }, + "foreign_keys": {} }, "update_column_MediaType_MediaTypeId": { "description": "Update the 'MediaTypeId' column in the 'MediaType' collection", @@ -7724,7 +7826,8 @@ snapshot_kind: text "name": "int4" } } - } + }, + "foreign_keys": {} }, "update_column_MediaType_Name": { "description": "Update the 'Name' column in the 'MediaType' collection", @@ -7739,7 +7842,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_column_PlaylistTrack_PlaylistId": { "description": "Update the 'PlaylistId' column in the 'PlaylistTrack' collection", @@ -7751,7 +7855,8 @@ snapshot_kind: text "name": "int4" } } - } + }, + "foreign_keys": {} }, "update_column_PlaylistTrack_TrackId": { "description": "Update the 'TrackId' column in the 'PlaylistTrack' collection", @@ -7763,7 +7868,8 @@ snapshot_kind: text "name": "int4" } } - } + }, + "foreign_keys": {} }, "update_column_Playlist_Name": { "description": "Update the 'Name' column in the 'Playlist' collection", @@ -7778,7 +7884,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_column_Playlist_PlaylistId": { "description": "Update the 'PlaylistId' column in the 'Playlist' collection", @@ -7790,7 +7897,8 @@ snapshot_kind: text "name": "int4" } } - } + }, + "foreign_keys": {} }, "update_column_Track_AlbumId": { "description": "Update the 'AlbumId' column in the 'Track' collection", @@ -7805,7 +7913,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_column_Track_Bytes": { "description": "Update the 'Bytes' column in the 'Track' collection", @@ -7820,7 +7929,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_column_Track_Composer": { "description": "Update the 'Composer' column in the 'Track' collection", @@ -7835,7 +7945,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_column_Track_GenreId": { "description": "Update the 'GenreId' column in the 'Track' collection", @@ -7850,7 +7961,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_column_Track_MediaTypeId": { "description": "Update the 'MediaTypeId' column in the 'Track' collection", @@ -7862,7 +7974,8 @@ snapshot_kind: text "name": "int4" } } - } + }, + "foreign_keys": {} }, "update_column_Track_Milliseconds": { "description": "Update the 'Milliseconds' column in the 'Track' collection", @@ -7874,7 +7987,8 @@ snapshot_kind: text "name": "int4" } } - } + }, + "foreign_keys": {} }, "update_column_Track_Name": { "description": "Update the 'Name' column in the 'Track' collection", @@ -7886,7 +8000,8 @@ snapshot_kind: text "name": "varchar" } } - } + }, + "foreign_keys": {} }, "update_column_Track_TrackId": { "description": "Update the 'TrackId' column in the 'Track' collection", @@ -7898,7 +8013,8 @@ snapshot_kind: text "name": "int4" } } - } + }, + "foreign_keys": {} }, "update_column_Track_UnitPrice": { "description": "Update the 'UnitPrice' column in the 'Track' collection", @@ -7910,7 +8026,8 @@ snapshot_kind: text "name": "numeric" } } - } + }, + "foreign_keys": {} }, "update_column_custom_defaults_birthday": { "description": "Update the 'birthday' column in the 'custom_defaults' collection", @@ -7922,7 +8039,8 @@ snapshot_kind: text "name": "date" } } - } + }, + "foreign_keys": {} }, "update_column_custom_defaults_height_cm": { "description": "Update the 'height_cm' column in the 'custom_defaults' collection", @@ -7934,7 +8052,8 @@ snapshot_kind: text "name": "numeric" } } - } + }, + "foreign_keys": {} }, "update_column_custom_defaults_name": { "description": "Update the 'name' column in the 'custom_defaults' collection", @@ -7949,7 +8068,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_column_custom_dog_adopter_name": { "description": "Update the 'adopter_name' column in the 'custom_dog' collection", @@ -7964,7 +8084,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_column_custom_dog_birthday": { "description": "Update the 'birthday' column in the 'custom_dog' collection", @@ -7976,7 +8097,8 @@ snapshot_kind: text "name": "date" } } - } + }, + "foreign_keys": {} }, "update_column_custom_dog_height_cm": { "description": "Update the 'height_cm' column in the 'custom_dog' collection", @@ -7988,7 +8110,8 @@ snapshot_kind: text "name": "numeric" } } - } + }, + "foreign_keys": {} }, "update_column_custom_dog_name": { "description": "Update the 'name' column in the 'custom_dog' collection", @@ -8000,7 +8123,8 @@ snapshot_kind: text "name": "text" } } - } + }, + "foreign_keys": {} }, "update_column_institution_institution_departments": { "description": "Update the 'departments' column in the 'institution_institution' collection", @@ -8021,7 +8145,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_column_institution_institution_id": { "description": "Update the 'id' column in the 'institution_institution' collection", @@ -8033,7 +8158,8 @@ snapshot_kind: text "name": "int4" } } - } + }, + "foreign_keys": {} }, "update_column_institution_institution_location": { "description": "Update the 'location' column in the 'institution_institution' collection", @@ -8048,7 +8174,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_column_institution_institution_name": { "description": "Update the 'name' column in the 'institution_institution' collection", @@ -8063,7 +8190,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_column_institution_institution_songs": { "description": "Update the 'songs' column in the 'institution_institution' collection", @@ -8078,7 +8206,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_column_institution_institution_staff": { "description": "Update the 'staff' column in the 'institution_institution' collection", @@ -8099,7 +8228,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_column_spatial_ref_sys_auth_name": { "description": "Update the 'auth_name' column in the 'spatial_ref_sys' collection", @@ -8114,7 +8244,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_column_spatial_ref_sys_auth_srid": { "description": "Update the 'auth_srid' column in the 'spatial_ref_sys' collection", @@ -8129,7 +8260,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_column_spatial_ref_sys_proj4text": { "description": "Update the 'proj4text' column in the 'spatial_ref_sys' collection", @@ -8144,7 +8276,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_column_spatial_ref_sys_srid": { "description": "Update the 'srid' column in the 'spatial_ref_sys' collection", @@ -8156,7 +8289,8 @@ snapshot_kind: text "name": "int4" } } - } + }, + "foreign_keys": {} }, "update_column_spatial_ref_sys_srtext": { "description": "Update the 'srtext' column in the 'spatial_ref_sys' collection", @@ -8171,7 +8305,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_column_topology_layer_child_id": { "description": "Update the 'child_id' column in the 'topology_layer' collection", @@ -8186,7 +8321,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_column_topology_layer_feature_column": { "description": "Update the 'feature_column' column in the 'topology_layer' collection", @@ -8198,7 +8334,8 @@ snapshot_kind: text "name": "varchar" } } - } + }, + "foreign_keys": {} }, "update_column_topology_layer_feature_type": { "description": "Update the 'feature_type' column in the 'topology_layer' collection", @@ -8210,7 +8347,8 @@ snapshot_kind: text "name": "int4" } } - } + }, + "foreign_keys": {} }, "update_column_topology_layer_layer_id": { "description": "Update the 'layer_id' column in the 'topology_layer' collection", @@ -8222,7 +8360,8 @@ snapshot_kind: text "name": "int4" } } - } + }, + "foreign_keys": {} }, "update_column_topology_layer_level": { "description": "Update the 'level' column in the 'topology_layer' collection", @@ -8234,7 +8373,8 @@ snapshot_kind: text "name": "int4" } } - } + }, + "foreign_keys": {} }, "update_column_topology_layer_schema_name": { "description": "Update the 'schema_name' column in the 'topology_layer' collection", @@ -8246,7 +8386,8 @@ snapshot_kind: text "name": "varchar" } } - } + }, + "foreign_keys": {} }, "update_column_topology_layer_table_name": { "description": "Update the 'table_name' column in the 'topology_layer' collection", @@ -8258,7 +8399,8 @@ snapshot_kind: text "name": "varchar" } } - } + }, + "foreign_keys": {} }, "update_column_topology_layer_topology_id": { "description": "Update the 'topology_id' column in the 'topology_layer' collection", @@ -8270,7 +8412,8 @@ snapshot_kind: text "name": "int4" } } - } + }, + "foreign_keys": {} }, "update_column_topology_topology_hasz": { "description": "Update the 'hasz' column in the 'topology_topology' collection", @@ -8282,7 +8425,8 @@ snapshot_kind: text "name": "bool" } } - } + }, + "foreign_keys": {} }, "update_column_topology_topology_id": { "description": "Update the 'id' column in the 'topology_topology' collection", @@ -8294,7 +8438,8 @@ snapshot_kind: text "name": "int4" } } - } + }, + "foreign_keys": {} }, "update_column_topology_topology_name": { "description": "Update the 'name' column in the 'topology_topology' collection", @@ -8306,7 +8451,8 @@ snapshot_kind: text "name": "varchar" } } - } + }, + "foreign_keys": {} }, "update_column_topology_topology_precision": { "description": "Update the 'precision' column in the 'topology_topology' collection", @@ -8318,7 +8464,8 @@ snapshot_kind: text "name": "float8" } } - } + }, + "foreign_keys": {} }, "update_column_topology_topology_srid": { "description": "Update the 'srid' column in the 'topology_topology' collection", @@ -8330,7 +8477,8 @@ snapshot_kind: text "name": "int4" } } - } + }, + "foreign_keys": {} }, "update_custom_defaults_by_id_response": { "description": "Responses from the 'update_custom_defaults_by_id' procedure", @@ -8352,7 +8500,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_custom_defaults_by_id_update_columns": { "description": "Update the columns of the 'custom_defaults' collection", @@ -8387,7 +8536,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_custom_dog_by_id_response": { "description": "Responses from the 'update_custom_dog_by_id' procedure", @@ -8409,7 +8559,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_custom_dog_by_id_update_columns": { "description": "Update the columns of the 'custom_dog' collection", @@ -8454,7 +8605,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_institution_institution_by_id_response": { "description": "Responses from the 'update_institution_institution_by_id' procedure", @@ -8476,7 +8628,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_institution_institution_by_id_update_columns": { "description": "Update the columns of the 'institution_institution' collection", @@ -8541,7 +8694,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_spatial_ref_sys_by_srid_response": { "description": "Responses from the 'update_spatial_ref_sys_by_srid' procedure", @@ -8563,7 +8717,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_spatial_ref_sys_by_srid_update_columns": { "description": "Update the columns of the 'spatial_ref_sys' collection", @@ -8618,7 +8773,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_topology_layer_by_feature_column_and_schema_name_and_table_name_response": { "description": "Responses from the 'update_topology_layer_by_feature_column_and_schema_name_and_table_name' procedure", @@ -8640,7 +8796,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_topology_layer_by_feature_column_and_schema_name_and_table_name_update_columns": { "description": "Update the columns of the 'topology_layer' collection", @@ -8725,7 +8882,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_topology_layer_by_layer_id_and_topology_id_response": { "description": "Responses from the 'update_topology_layer_by_layer_id_and_topology_id' procedure", @@ -8747,7 +8905,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_topology_layer_by_layer_id_and_topology_id_update_columns": { "description": "Update the columns of the 'topology_layer' collection", @@ -8832,7 +8991,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_topology_topology_by_id_response": { "description": "Responses from the 'update_topology_topology_by_id' procedure", @@ -8854,7 +9014,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_topology_topology_by_id_update_columns": { "description": "Update the columns of the 'topology_topology' collection", @@ -8909,7 +9070,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_topology_topology_by_name_response": { "description": "Responses from the 'update_topology_topology_by_name' procedure", @@ -8931,7 +9093,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "update_topology_topology_by_name_update_columns": { "description": "Update the columns of the 'topology_topology' collection", @@ -8986,7 +9149,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} }, "value_types": { "fields": { @@ -9134,7 +9298,8 @@ snapshot_kind: text } } } - } + }, + "foreign_keys": {} } }, "collections": [ @@ -9149,14 +9314,6 @@ snapshot_kind: text "AlbumId" ] } - }, - "foreign_keys": { - "FK_AlbumArtistId": { - "column_mapping": { - "ArtistId": "ArtistId" - }, - "foreign_collection": "Artist" - } } }, { @@ -9170,8 +9327,7 @@ snapshot_kind: text "ArtistId" ] } - }, - "foreign_keys": {} + } }, { "name": "Customer", @@ -9184,14 +9340,6 @@ snapshot_kind: text "CustomerId" ] } - }, - "foreign_keys": { - "FK_CustomerSupportRepId": { - "column_mapping": { - "SupportRepId": "EmployeeId" - }, - "foreign_collection": "Employee" - } } }, { @@ -9204,14 +9352,6 @@ snapshot_kind: text "EmployeeId" ] } - }, - "foreign_keys": { - "FK_EmployeeReportsTo": { - "column_mapping": { - "ReportsTo": "EmployeeId" - }, - "foreign_collection": "Employee" - } } }, { @@ -9224,8 +9364,7 @@ snapshot_kind: text "GenreId" ] } - }, - "foreign_keys": {} + } }, { "name": "Invoice", @@ -9237,14 +9376,6 @@ snapshot_kind: text "InvoiceId" ] } - }, - "foreign_keys": { - "FK_InvoiceCustomerId": { - "column_mapping": { - "CustomerId": "CustomerId" - }, - "foreign_collection": "Customer" - } } }, { @@ -9257,20 +9388,6 @@ snapshot_kind: text "InvoiceLineId" ] } - }, - "foreign_keys": { - "FK_InvoiceLineInvoiceId": { - "column_mapping": { - "InvoiceId": "InvoiceId" - }, - "foreign_collection": "Invoice" - }, - "FK_InvoiceLineTrackId": { - "column_mapping": { - "TrackId": "TrackId" - }, - "foreign_collection": "Track" - } } }, { @@ -9283,8 +9400,7 @@ snapshot_kind: text "MediaTypeId" ] } - }, - "foreign_keys": {} + } }, { "name": "Playlist", @@ -9296,8 +9412,7 @@ snapshot_kind: text "PlaylistId" ] } - }, - "foreign_keys": {} + } }, { "name": "PlaylistTrack", @@ -9310,20 +9425,6 @@ snapshot_kind: text "TrackId" ] } - }, - "foreign_keys": { - "FK_PlaylistTrackPlaylistId": { - "column_mapping": { - "PlaylistId": "PlaylistId" - }, - "foreign_collection": "Playlist" - }, - "FK_PlaylistTrackTrackId": { - "column_mapping": { - "TrackId": "TrackId" - }, - "foreign_collection": "Track" - } } }, { @@ -9336,26 +9437,6 @@ snapshot_kind: text "TrackId" ] } - }, - "foreign_keys": { - "FK_TrackAlbumId": { - "column_mapping": { - "AlbumId": "AlbumId" - }, - "foreign_collection": "Album" - }, - "FK_TrackGenreId": { - "column_mapping": { - "GenreId": "GenreId" - }, - "foreign_collection": "Genre" - }, - "FK_TrackMediaTypeId": { - "column_mapping": { - "MediaTypeId": "MediaTypeId" - }, - "foreign_collection": "MediaType" - } } }, { @@ -9368,8 +9449,7 @@ snapshot_kind: text "id" ] } - }, - "foreign_keys": {} + } }, { "name": "custom_dog", @@ -9381,43 +9461,37 @@ snapshot_kind: text "id" ] } - }, - "foreign_keys": {} + } }, { "name": "custom_test_cidr", "arguments": {}, "type": "custom_test_cidr", - "uniqueness_constraints": {}, - "foreign_keys": {} + "uniqueness_constraints": {} }, { "name": "deck_of_cards", "arguments": {}, "type": "deck_of_cards", - "uniqueness_constraints": {}, - "foreign_keys": {} + "uniqueness_constraints": {} }, { "name": "discoverable_types_root_occurrence", "arguments": {}, "type": "discoverable_types_root_occurrence", - "uniqueness_constraints": {}, - "foreign_keys": {} + "uniqueness_constraints": {} }, { "name": "even_numbers", "arguments": {}, "type": "even_numbers", - "uniqueness_constraints": {}, - "foreign_keys": {} + "uniqueness_constraints": {} }, { "name": "group_leader", "arguments": {}, "type": "group_leader", - "uniqueness_constraints": {}, - "foreign_keys": {} + "uniqueness_constraints": {} }, { "name": "institution_institution", @@ -9429,15 +9503,13 @@ snapshot_kind: text "id" ] } - }, - "foreign_keys": {} + } }, { "name": "phone_numbers", "arguments": {}, "type": "phone_numbers", - "uniqueness_constraints": {}, - "foreign_keys": {} + "uniqueness_constraints": {} }, { "name": "spatial_ref_sys", @@ -9449,15 +9521,13 @@ snapshot_kind: text "srid" ] } - }, - "foreign_keys": {} + } }, { "name": "text_table", "arguments": {}, "type": "text_table", - "uniqueness_constraints": {}, - "foreign_keys": {} + "uniqueness_constraints": {} }, { "name": "topology_layer", @@ -9477,14 +9547,6 @@ snapshot_kind: text "table_name" ] } - }, - "foreign_keys": { - "layer_topology_id_fkey": { - "column_mapping": { - "topology_id": "id" - }, - "foreign_collection": "topology_topology" - } } }, { @@ -9502,8 +9564,7 @@ snapshot_kind: text "id" ] } - }, - "foreign_keys": {} + } }, { "name": "address_identity_function", @@ -9520,8 +9581,7 @@ snapshot_kind: text } }, "type": "address_identity_function", - "uniqueness_constraints": {}, - "foreign_keys": {} + "uniqueness_constraints": {} }, { "name": "album_by_title", @@ -9546,8 +9606,7 @@ snapshot_kind: text } }, "type": "album_by_title", - "uniqueness_constraints": {}, - "foreign_keys": {} + "uniqueness_constraints": {} }, { "name": "array_reverse", @@ -9568,8 +9627,7 @@ snapshot_kind: text } }, "type": "array_reverse", - "uniqueness_constraints": {}, - "foreign_keys": {} + "uniqueness_constraints": {} }, { "name": "array_series", @@ -9595,15 +9653,13 @@ snapshot_kind: text } }, "type": "array_series", - "uniqueness_constraints": {}, - "foreign_keys": {} + "uniqueness_constraints": {} }, { "name": "artist", "arguments": {}, "type": "artist", - "uniqueness_constraints": {}, - "foreign_keys": {} + "uniqueness_constraints": {} }, { "name": "artist_below_id", @@ -9619,8 +9675,7 @@ snapshot_kind: text } }, "type": "artist_below_id", - "uniqueness_constraints": {}, - "foreign_keys": {} + "uniqueness_constraints": {} }, { "name": "count_elements", @@ -9643,8 +9698,7 @@ snapshot_kind: text } }, "type": "count_elements", - "uniqueness_constraints": {}, - "foreign_keys": {} + "uniqueness_constraints": {} }, { "name": "make_person", @@ -9670,8 +9724,7 @@ snapshot_kind: text } }, "type": "make_person", - "uniqueness_constraints": {}, - "foreign_keys": {} + "uniqueness_constraints": {} }, { "name": "organization_identity_function", @@ -9688,8 +9741,7 @@ snapshot_kind: text } }, "type": "organization_identity_function", - "uniqueness_constraints": {}, - "foreign_keys": {} + "uniqueness_constraints": {} }, { "name": "summarize_organizations", @@ -9712,8 +9764,7 @@ snapshot_kind: text } }, "type": "summarize_organizations", - "uniqueness_constraints": {}, - "foreign_keys": {} + "uniqueness_constraints": {} }, { "name": "value_types", @@ -9864,8 +9915,7 @@ snapshot_kind: text } }, "type": "value_types", - "uniqueness_constraints": {}, - "foreign_keys": {} + "uniqueness_constraints": {} } ], "functions": [], @@ -11993,5 +12043,12 @@ snapshot_kind: text "name": "update_topology_topology_by_name_response" } } - ] + ], + "capabilities": { + "query": { + "aggregates": { + "count_scalar_type": "int8" + } + } + } } diff --git a/crates/tests/databases-tests/src/snapshots/databases_tests__capabilities_tests__get_capabilities.snap b/crates/tests/databases-tests/src/snapshots/databases_tests__capabilities_tests__get_capabilities.snap index ec31756c1..66f37ed1d 100644 --- a/crates/tests/databases-tests/src/snapshots/databases_tests__capabilities_tests__get_capabilities.snap +++ b/crates/tests/databases-tests/src/snapshots/databases_tests__capabilities_tests__get_capabilities.snap @@ -1,6 +1,7 @@ --- source: crates/tests/databases-tests/src/capabilities_tests.rs expression: "ndc_postgres::capabilities::get_capabilities()" +snapshot_kind: text --- { "query": { @@ -9,7 +10,8 @@ expression: "ndc_postgres::capabilities::get_capabilities()" "explain": {}, "nested_fields": { "filter_by": {}, - "order_by": {} + "order_by": {}, + "aggregates": {} }, "exists": { "nested_collections": {} diff --git a/crates/tests/tests-common/Cargo.toml b/crates/tests/tests-common/Cargo.toml index 7794b82c1..237235ea9 100644 --- a/crates/tests/tests-common/Cargo.toml +++ b/crates/tests/tests-common/Cargo.toml @@ -27,8 +27,12 @@ reqwest = { workspace = true } schemars = { workspace = true } serde = { workspace = true } serde_json = { workspace = true, features = ["raw_value"] } -sqlx = { workspace = true, features = [ "json", "postgres", "runtime-tokio-rustls" ] } +sqlx = { workspace = true, features = [ + "json", + "postgres", + "runtime-tokio-rustls", +] } tokio = { workspace = true, features = ["full"] } tracing = { workspace = true } url = { workspace = true } -uuid = { workspace = true, features = [ "v4", "fast-rng", "macro-diagnostics" ] } +uuid = { workspace = true, features = ["v4", "fast-rng", "macro-diagnostics"] } diff --git a/crates/tests/tests-common/goldenfiles/aggregate_count_artist_albums.json b/crates/tests/tests-common/goldenfiles/aggregate_count_artist_albums.json index c6c02d46e..92b94c97d 100644 --- a/crates/tests/tests-common/goldenfiles/aggregate_count_artist_albums.json +++ b/crates/tests/tests-common/goldenfiles/aggregate_count_artist_albums.json @@ -40,7 +40,7 @@ "collection_relationships": { "ArtistToAlbums": { "column_mapping": { - "ArtistId": "ArtistId" + "ArtistId": ["ArtistId"] }, "relationship_type": "array", "target_collection": "Album", diff --git a/crates/tests/tests-common/goldenfiles/aggregate_count_artist_albums_plus_field.json b/crates/tests/tests-common/goldenfiles/aggregate_count_artist_albums_plus_field.json index 4dbad7617..2e739ac95 100644 --- a/crates/tests/tests-common/goldenfiles/aggregate_count_artist_albums_plus_field.json +++ b/crates/tests/tests-common/goldenfiles/aggregate_count_artist_albums_plus_field.json @@ -59,7 +59,7 @@ "collection_relationships": { "ArtistToAlbums": { "column_mapping": { - "ArtistId": "ArtistId" + "ArtistId": ["ArtistId"] }, "relationship_type": "array", "target_collection": "Album", diff --git a/crates/tests/tests-common/goldenfiles/dup_array_relationship.json b/crates/tests/tests-common/goldenfiles/dup_array_relationship.json index 819b01ad2..2b92f88b4 100644 --- a/crates/tests/tests-common/goldenfiles/dup_array_relationship.json +++ b/crates/tests/tests-common/goldenfiles/dup_array_relationship.json @@ -74,7 +74,7 @@ "collection_relationships": { "ArtistAlbums": { "column_mapping": { - "ArtistId": "ArtistId" + "ArtistId": ["ArtistId"] }, "relationship_type": "array", "target_collection": "Album", diff --git a/crates/tests/tests-common/goldenfiles/duplicate_filter_results.json b/crates/tests/tests-common/goldenfiles/duplicate_filter_results.json index f7de89b9d..d2536fa73 100644 --- a/crates/tests/tests-common/goldenfiles/duplicate_filter_results.json +++ b/crates/tests/tests-common/goldenfiles/duplicate_filter_results.json @@ -10,25 +10,23 @@ } }, "predicate": { - "type": "binary_comparison_operator", - "column": { - "type": "column", - "name": "Title", - "path": [ - { - "relationship": "Artist_Albums", - "arguments": {}, - "predicate": { - "type": "and", - "expressions": [] - } - } - ] + "type": "exists", + "in_collection": { + "type": "related", + "relationship": "Artist_Albums", + "arguments": {} }, - "operator": "_like", - "value": { - "type": "scalar", - "value": "%e%" + "predicate": { + "type": "binary_comparison_operator", + "column": { + "type": "column", + "name": "Title" + }, + "operator": "_like", + "value": { + "type": "scalar", + "value": "%e%" + } } }, "order_by": { @@ -50,7 +48,7 @@ "Artist_Albums": { "arguments": {}, "column_mapping": { - "ArtistId": "ArtistId" + "ArtistId": ["ArtistId"] }, "relationship_type": "array", "target_collection": "Album" diff --git a/crates/tests/tests-common/goldenfiles/duplicate_filter_results_nested.json b/crates/tests/tests-common/goldenfiles/duplicate_filter_results_nested.json index 648847205..fe3bf2430 100644 --- a/crates/tests/tests-common/goldenfiles/duplicate_filter_results_nested.json +++ b/crates/tests/tests-common/goldenfiles/duplicate_filter_results_nested.json @@ -13,55 +13,51 @@ "type": "or", "expressions": [ { - "type": "binary_comparison_operator", - "column": { - "type": "column", - "name": "Name", - "path": [ - { - "relationship": "Artist_Albums", - "arguments": {}, - "predicate": { - "type": "and", - "expressions": [] - } + "type": "exists", + "in_collection": { + "type": "related", + "relationship": "Artist_Albums", + "arguments": {} + }, + "predicate": { + "type": "exists", + "in_collection": { + "type": "related", + "relationship": "Albums_Tracks", + "arguments": {} + }, + "predicate": { + "type": "binary_comparison_operator", + "column": { + "type": "column", + "name": "Name" }, - { - "relationship": "Albums_Tracks", - "arguments": {}, - "predicate": { - "type": "and", - "expressions": [] - } + "operator": "_like", + "value": { + "type": "scalar", + "value": "%e%" } - ] - }, - "operator": "_like", - "value": { - "type": "scalar", - "value": "%e%" + } } }, { - "type": "binary_comparison_operator", - "column": { - "type": "column", - "name": "Title", - "path": [ - { - "relationship": "Artist_Albums", - "arguments": {}, - "predicate": { - "type": "and", - "expressions": [] - } - } - ] + "type": "exists", + "in_collection": { + "type": "related", + "relationship": "Artist_Albums", + "arguments": {} }, - "operator": "_like", - "value": { - "type": "scalar", - "value": "%e%" + "predicate": { + "type": "binary_comparison_operator", + "column": { + "type": "column", + "name": "Title" + }, + "operator": "_like", + "value": { + "type": "scalar", + "value": "%e%" + } } } ] @@ -85,7 +81,7 @@ "Artist_Albums": { "arguments": {}, "column_mapping": { - "ArtistId": "ArtistId" + "ArtistId": ["ArtistId"] }, "relationship_type": "array", "target_collection": "Album" @@ -93,7 +89,7 @@ "Albums_Tracks": { "arguments": {}, "column_mapping": { - "AlbumId": "AlbumId" + "AlbumId": ["AlbumId"] }, "relationship_type": "array", "target_collection": "Track" diff --git a/crates/tests/tests-common/goldenfiles/mutations/delete_invoice_line.json b/crates/tests/tests-common/goldenfiles/mutations/delete_invoice_line.json index 1c2d72370..3b3a1a64b 100644 --- a/crates/tests/tests-common/goldenfiles/mutations/delete_invoice_line.json +++ b/crates/tests/tests-common/goldenfiles/mutations/delete_invoice_line.json @@ -7,21 +7,23 @@ "arguments": { "key_InvoiceLineId": 90, "pre_check": { - "type": "binary_comparison_operator", - "column": { - "type": "column", - "name": "TrackId", - "path": [ - { - "relationship": "InvoiceLineTrack", - "arguments": {} - } - ] + "type": "exists", + "in_collection": { + "type": "related", + "relationship": "InvoiceLineTrack", + "arguments": {} }, - "operator": "_eq", - "value": { - "type": "scalar", - "value": 512 + "predicate": { + "type": "binary_comparison_operator", + "column": { + "type": "column", + "name": "TrackId" + }, + "operator": "_eq", + "value": { + "type": "scalar", + "value": 512 + } } } }, @@ -59,7 +61,7 @@ "collection_relationships": { "InvoiceLineTrack": { "column_mapping": { - "TrackId": "TrackId" + "TrackId": ["TrackId"] }, "relationship_type": "object", "target_collection": "Track", diff --git a/crates/tests/tests-common/goldenfiles/mutations/insert_artist_album.json b/crates/tests/tests-common/goldenfiles/mutations/insert_artist_album.json index 1060a97ea..f27fe90d7 100644 --- a/crates/tests/tests-common/goldenfiles/mutations/insert_artist_album.json +++ b/crates/tests/tests-common/goldenfiles/mutations/insert_artist_album.json @@ -97,7 +97,7 @@ "collection_relationships": { "AlbumToArtist": { "column_mapping": { - "ArtistId": "ArtistId" + "ArtistId": ["ArtistId"] }, "relationship_type": "object", "target_collection": "Artist", diff --git a/crates/tests/tests-common/goldenfiles/mutations/insert_artist_album_bad.json b/crates/tests/tests-common/goldenfiles/mutations/insert_artist_album_bad.json index c700deb3e..29dffff3a 100644 --- a/crates/tests/tests-common/goldenfiles/mutations/insert_artist_album_bad.json +++ b/crates/tests/tests-common/goldenfiles/mutations/insert_artist_album_bad.json @@ -97,7 +97,7 @@ "collection_relationships": { "AlbumToArtist": { "column_mapping": { - "ArtistId": "ArtistId" + "ArtistId": ["ArtistId"] }, "relationship_type": "object", "target_collection": "Artist", diff --git a/crates/tests/tests-common/goldenfiles/native_queries/select_artist_with_album_by_title_relationship_arguments.json b/crates/tests/tests-common/goldenfiles/native_queries/select_artist_with_album_by_title_relationship_arguments.json index 4116a76e7..ffd70aba9 100644 --- a/crates/tests/tests-common/goldenfiles/native_queries/select_artist_with_album_by_title_relationship_arguments.json +++ b/crates/tests/tests-common/goldenfiles/native_queries/select_artist_with_album_by_title_relationship_arguments.json @@ -58,7 +58,7 @@ "collection_relationships": { "Albums": { "column_mapping": { - "ArtistId": "ArtistId" + "ArtistId": ["ArtistId"] }, "relationship_type": "array", "target_collection": "album_by_title", diff --git a/crates/tests/tests-common/goldenfiles/native_queries/select_order_by_artist_album_count.json b/crates/tests/tests-common/goldenfiles/native_queries/select_order_by_artist_album_count.json index 7ff101f5e..61e29d8fc 100644 --- a/crates/tests/tests-common/goldenfiles/native_queries/select_order_by_artist_album_count.json +++ b/crates/tests/tests-common/goldenfiles/native_queries/select_order_by_artist_album_count.json @@ -45,7 +45,10 @@ { "order_direction": "desc", "target": { - "type": "star_count_aggregate", + "type": "aggregate", + "aggregate": { + "type": "star_count" + }, "path": [ { "relationship": "ArtistAlbums", @@ -74,7 +77,7 @@ "collection_relationships": { "ArtistAlbums": { "column_mapping": { - "ArtistId": "ArtistId" + "ArtistId": ["ArtistId"] }, "relationship_type": "array", "target_collection": "album_by_title", diff --git a/crates/tests/tests-common/goldenfiles/native_queries/select_sort_relationship.json b/crates/tests/tests-common/goldenfiles/native_queries/select_sort_relationship.json index 612425346..0654e7d34 100644 --- a/crates/tests/tests-common/goldenfiles/native_queries/select_sort_relationship.json +++ b/crates/tests/tests-common/goldenfiles/native_queries/select_sort_relationship.json @@ -52,7 +52,7 @@ "collection_relationships": { "AlbumToArtist": { "column_mapping": { - "ArtistId": "ArtistId" + "ArtistId": ["ArtistId"] }, "relationship_type": "object", "target_collection": "artist", diff --git a/crates/tests/tests-common/goldenfiles/native_queries/select_where_relationship.json b/crates/tests/tests-common/goldenfiles/native_queries/select_where_relationship.json index 91cb776ef..dd49ea2b6 100644 --- a/crates/tests/tests-common/goldenfiles/native_queries/select_where_relationship.json +++ b/crates/tests/tests-common/goldenfiles/native_queries/select_where_relationship.json @@ -28,25 +28,23 @@ }, "limit": 5, "predicate": { - "type": "binary_comparison_operator", - "column": { - "type": "column", - "name": "Name", - "path": [ - { - "relationship": "AlbumToArtist", - "arguments": {}, - "predicate": { - "type": "and", - "expressions": [] - } - } - ] + "type": "exists", + "in_collection": { + "type": "related", + "relationship": "AlbumToArtist", + "arguments": {} }, - "operator": "_like", - "value": { - "type": "scalar", - "value": "A%" + "predicate": { + "type": "binary_comparison_operator", + "column": { + "type": "column", + "name": "Name" + }, + "operator": "_like", + "value": { + "type": "scalar", + "value": "A%" + } } } }, @@ -57,7 +55,7 @@ "collection_relationships": { "AlbumToArtist": { "column_mapping": { - "ArtistId": "ArtistId" + "ArtistId": ["ArtistId"] }, "relationship_type": "object", "target_collection": "artist", diff --git a/crates/tests/tests-common/goldenfiles/nested_array_relationships.json b/crates/tests/tests-common/goldenfiles/nested_array_relationships.json index 6c89c2f05..7b701a060 100644 --- a/crates/tests/tests-common/goldenfiles/nested_array_relationships.json +++ b/crates/tests/tests-common/goldenfiles/nested_array_relationships.json @@ -82,7 +82,7 @@ "collection_relationships": { "ArtistAlbums": { "column_mapping": { - "ArtistId": "ArtistId" + "ArtistId": ["ArtistId"] }, "relationship_type": "array", "target_collection": "Album", @@ -90,7 +90,7 @@ }, "AlbumTracks": { "column_mapping": { - "AlbumId": "AlbumId" + "AlbumId": ["AlbumId"] }, "relationship_type": "array", "target_collection": "Track", diff --git a/crates/tests/tests-common/goldenfiles/nested_field_relationship.json b/crates/tests/tests-common/goldenfiles/nested_field_relationship.json index 08d29910e..e2f5ca9cf 100644 --- a/crates/tests/tests-common/goldenfiles/nested_field_relationship.json +++ b/crates/tests/tests-common/goldenfiles/nested_field_relationship.json @@ -45,7 +45,7 @@ "collection_relationships": { "default___staff_member__favourite_artist": { "column_mapping": { - "favourite_artist_id": "ArtistId" + "favourite_artist_id": ["ArtistId"] }, "relationship_type": "object", "target_collection": "Artist", diff --git a/crates/tests/tests-common/goldenfiles/nested_object_relationships.json b/crates/tests/tests-common/goldenfiles/nested_object_relationships.json index d9fa338d1..b4e9ac0ca 100644 --- a/crates/tests/tests-common/goldenfiles/nested_object_relationships.json +++ b/crates/tests/tests-common/goldenfiles/nested_object_relationships.json @@ -56,7 +56,7 @@ "collection_relationships": { "TrackToAlbum": { "column_mapping": { - "AlbumId": "AlbumId" + "AlbumId": ["AlbumId"] }, "relationship_type": "object", "target_collection": "Album", @@ -64,7 +64,7 @@ }, "AlbumToArtist": { "column_mapping": { - "ArtistId": "ArtistId" + "ArtistId": ["ArtistId"] }, "relationship_type": "object", "target_collection": "Artist", diff --git a/crates/tests/tests-common/goldenfiles/select_album_object_relationship_to_artist.json b/crates/tests/tests-common/goldenfiles/select_album_object_relationship_to_artist.json index c3a42f643..0ed8988f2 100644 --- a/crates/tests/tests-common/goldenfiles/select_album_object_relationship_to_artist.json +++ b/crates/tests/tests-common/goldenfiles/select_album_object_relationship_to_artist.json @@ -42,7 +42,7 @@ "collection_relationships": { "AlbumToArtist": { "column_mapping": { - "ArtistId": "ArtistId" + "ArtistId": ["ArtistId"] }, "relationship_type": "object", "target_collection": "Artist", diff --git a/crates/tests/tests-common/goldenfiles/select_artist_array_relationship_to_album.json b/crates/tests/tests-common/goldenfiles/select_artist_array_relationship_to_album.json index a592f76b7..7818812a8 100644 --- a/crates/tests/tests-common/goldenfiles/select_artist_array_relationship_to_album.json +++ b/crates/tests/tests-common/goldenfiles/select_artist_array_relationship_to_album.json @@ -54,7 +54,7 @@ "collection_relationships": { "ArtistToAlbums": { "column_mapping": { - "ArtistId": "ArtistId" + "ArtistId": ["ArtistId"] }, "relationship_type": "array", "target_collection": "Album", diff --git a/crates/tests/tests-common/goldenfiles/select_order_by_album_artist_name.json b/crates/tests/tests-common/goldenfiles/select_order_by_album_artist_name.json index 0161ad3d9..30090ef5a 100644 --- a/crates/tests/tests-common/goldenfiles/select_order_by_album_artist_name.json +++ b/crates/tests/tests-common/goldenfiles/select_order_by_album_artist_name.json @@ -52,7 +52,7 @@ "collection_relationships": { "AlbumArtist": { "column_mapping": { - "ArtistId": "ArtistId" + "ArtistId": ["ArtistId"] }, "relationship_type": "object", "target_collection": "Artist", @@ -60,7 +60,7 @@ }, "TrackAlbum": { "column_mapping": { - "AlbumId": "AlbumId" + "AlbumId": ["AlbumId"] }, "relationship_type": "object", "target_collection": "Album", diff --git a/crates/tests/tests-common/goldenfiles/select_order_by_artist_album_count.json b/crates/tests/tests-common/goldenfiles/select_order_by_artist_album_count.json index d25c2cedd..c9cf0dfee 100644 --- a/crates/tests/tests-common/goldenfiles/select_order_by_artist_album_count.json +++ b/crates/tests/tests-common/goldenfiles/select_order_by_artist_album_count.json @@ -15,7 +15,10 @@ { "order_direction": "desc", "target": { - "type": "star_count_aggregate", + "type": "aggregate", + "aggregate": { + "type": "star_count" + }, "path": [ { "relationship": "ArtistAlbums", @@ -35,7 +38,7 @@ "collection_relationships": { "ArtistAlbums": { "column_mapping": { - "ArtistId": "ArtistId" + "ArtistId": ["ArtistId"] }, "relationship_type": "array", "target_collection": "Album", diff --git a/crates/tests/tests-common/goldenfiles/select_order_by_artist_album_count_agg.json b/crates/tests/tests-common/goldenfiles/select_order_by_artist_album_count_agg.json index bcfd5b633..c56a1c428 100644 --- a/crates/tests/tests-common/goldenfiles/select_order_by_artist_album_count_agg.json +++ b/crates/tests/tests-common/goldenfiles/select_order_by_artist_album_count_agg.json @@ -13,9 +13,12 @@ "elements": [ { "target": { - "type": "single_column_aggregate", - "column": "AlbumId", - "function": "count", + "type": "aggregate", + "aggregate": { + "type": "single_column", + "column": "AlbumId", + "function": "count" + }, "path": [ { "relationship": "ArtistAlbum", @@ -37,7 +40,7 @@ "collection_relationships": { "ArtistAlbum": { "column_mapping": { - "ArtistId": "ArtistId" + "ArtistId": ["ArtistId"] }, "relationship_type": "array", "target_collection": "Album", diff --git a/crates/tests/tests-common/goldenfiles/select_order_by_artist_name.json b/crates/tests/tests-common/goldenfiles/select_order_by_artist_name.json index b874669e4..103100299 100644 --- a/crates/tests/tests-common/goldenfiles/select_order_by_artist_name.json +++ b/crates/tests/tests-common/goldenfiles/select_order_by_artist_name.json @@ -45,7 +45,7 @@ "collection_relationships": { "AlbumArtist": { "column_mapping": { - "ArtistId": "ArtistId" + "ArtistId": ["ArtistId"] }, "relationship_type": "object", "target_collection": "Artist", diff --git a/crates/tests/tests-common/goldenfiles/select_order_by_artist_name_with_name.json b/crates/tests/tests-common/goldenfiles/select_order_by_artist_name_with_name.json index 81e27722c..256052a51 100644 --- a/crates/tests/tests-common/goldenfiles/select_order_by_artist_name_with_name.json +++ b/crates/tests/tests-common/goldenfiles/select_order_by_artist_name_with_name.json @@ -58,7 +58,7 @@ "collection_relationships": { "AlbumArtist": { "column_mapping": { - "ArtistId": "ArtistId" + "ArtistId": ["ArtistId"] }, "relationship_type": "object", "target_collection": "Artist", diff --git a/crates/tests/tests-common/goldenfiles/select_track_order_by_artist_id_and_album_title.json b/crates/tests/tests-common/goldenfiles/select_track_order_by_artist_id_and_album_title.json index e23078da4..09cac14b6 100644 --- a/crates/tests/tests-common/goldenfiles/select_track_order_by_artist_id_and_album_title.json +++ b/crates/tests/tests-common/goldenfiles/select_track_order_by_artist_id_and_album_title.json @@ -61,7 +61,7 @@ "collection_relationships": { "TrackAlbum": { "column_mapping": { - "AlbumId": "AlbumId" + "AlbumId": ["AlbumId"] }, "relationship_type": "object", "target_collection": "Album", diff --git a/crates/tests/tests-common/goldenfiles/select_where_album_id_equals_self.json b/crates/tests/tests-common/goldenfiles/select_where_album_id_equals_self.json index cf3bc11bf..19674eb75 100644 --- a/crates/tests/tests-common/goldenfiles/select_where_album_id_equals_self.json +++ b/crates/tests/tests-common/goldenfiles/select_where_album_id_equals_self.json @@ -27,11 +27,8 @@ "operator": "_eq", "value": { "type": "column", - "column": { - "type": "column", - "name": "AlbumId", - "path": [] - } + "name": "AlbumId", + "path": [] } }, { diff --git a/crates/tests/tests-common/goldenfiles/select_where_album_id_equals_self_nested_object_relationship.json b/crates/tests/tests-common/goldenfiles/select_where_album_id_equals_self_nested_object_relationship.json index 3aea7084f..b87554c33 100644 --- a/crates/tests/tests-common/goldenfiles/select_where_album_id_equals_self_nested_object_relationship.json +++ b/crates/tests/tests-common/goldenfiles/select_where_album_id_equals_self_nested_object_relationship.json @@ -79,28 +79,25 @@ "operator": "_gt", "value": { "type": "column", - "column": { - "type": "column", - "name": "ArtistId", - "path": [ - { - "relationship": "TrackToAlbum", - "arguments": {}, - "predicate": { - "type": "and", - "expressions": [] - } - }, - { - "relationship": "AlbumToArtist", - "arguments": {}, - "predicate": { - "type": "and", - "expressions": [] - } + "name": "ArtistId", + "path": [ + { + "relationship": "TrackToAlbum", + "arguments": {}, + "predicate": { + "type": "and", + "expressions": [] } - ] - } + }, + { + "relationship": "AlbumToArtist", + "arguments": {}, + "predicate": { + "type": "and", + "expressions": [] + } + } + ] } } }, @@ -108,7 +105,7 @@ "collection_relationships": { "TrackToAlbum": { "column_mapping": { - "AlbumId": "AlbumId" + "AlbumId": ["AlbumId"] }, "relationship_type": "object", "target_collection": "Album", @@ -116,7 +113,7 @@ }, "AlbumToArtist": { "column_mapping": { - "ArtistId": "ArtistId" + "ArtistId": ["ArtistId"] }, "relationship_type": "object", "target_collection": "Artist", diff --git a/crates/tests/tests-common/goldenfiles/select_where_array_relationship.json b/crates/tests/tests-common/goldenfiles/select_where_array_relationship.json index 9183cfe67..edbad921c 100644 --- a/crates/tests/tests-common/goldenfiles/select_where_array_relationship.json +++ b/crates/tests/tests-common/goldenfiles/select_where_array_relationship.json @@ -36,25 +36,23 @@ } }, "predicate": { - "type": "binary_comparison_operator", - "column": { - "type": "column", - "name": "Title", - "path": [ - { - "relationship": "Artist_Albums", - "arguments": {}, - "predicate": { - "type": "and", - "expressions": [] - } - } - ] + "type": "exists", + "in_collection": { + "type": "related", + "relationship": "Artist_Albums", + "arguments": {} }, - "operator": "_like", - "value": { - "type": "scalar", - "value": "Supernatural" + "predicate": { + "type": "binary_comparison_operator", + "column": { + "type": "column", + "name": "Title" + }, + "operator": "_like", + "value": { + "type": "scalar", + "value": "Supernatural" + } } }, "order_by": { @@ -75,7 +73,7 @@ "Artist_Albums": { "arguments": {}, "column_mapping": { - "ArtistId": "ArtistId" + "ArtistId": ["ArtistId"] }, "relationship_type": "array", "target_collection": "Album" diff --git a/crates/tests/tests-common/goldenfiles/select_where_in_column.json b/crates/tests/tests-common/goldenfiles/select_where_in_column.json index c732ba934..870ae51ea 100644 --- a/crates/tests/tests-common/goldenfiles/select_where_in_column.json +++ b/crates/tests/tests-common/goldenfiles/select_where_in_column.json @@ -19,11 +19,8 @@ "operator": "_in", "value": { "type": "column", - "column": { - "type": "column", - "name": "series", - "path": [] - } + "name": "series", + "path": [] } } }, diff --git a/crates/tests/tests-common/goldenfiles/select_where_related_exists.json b/crates/tests/tests-common/goldenfiles/select_where_related_exists.json index 256a0998c..509328521 100644 --- a/crates/tests/tests-common/goldenfiles/select_where_related_exists.json +++ b/crates/tests/tests-common/goldenfiles/select_where_related_exists.json @@ -74,7 +74,7 @@ "Artist_Albums": { "arguments": {}, "column_mapping": { - "ArtistId": "ArtistId" + "ArtistId": ["ArtistId"] }, "relationship_type": "array", "target_collection": "Album" diff --git a/crates/tests/tests-common/goldenfiles/select_where_unrelated_exists.json b/crates/tests/tests-common/goldenfiles/select_where_unrelated_exists.json index 1616f8c34..4c4be2785 100644 --- a/crates/tests/tests-common/goldenfiles/select_where_unrelated_exists.json +++ b/crates/tests/tests-common/goldenfiles/select_where_unrelated_exists.json @@ -35,17 +35,15 @@ { "type": "binary_comparison_operator", "column": { - "type": "root_collection_column", + "type": "column", "name": "ArtistId" }, "operator": "_eq", "value": { "type": "column", - "column": { - "type": "column", - "name": "ArtistId", - "path": [] - } + "name": "ArtistId", + "path": [], + "scope": 1 } } ] diff --git a/crates/tests/tests-common/goldenfiles/sorting_by_nested_relationship_column_with_predicate.json b/crates/tests/tests-common/goldenfiles/sorting_by_nested_relationship_column_with_predicate.json index 410ab0dc2..4ae315f14 100644 --- a/crates/tests/tests-common/goldenfiles/sorting_by_nested_relationship_column_with_predicate.json +++ b/crates/tests/tests-common/goldenfiles/sorting_by_nested_relationship_column_with_predicate.json @@ -66,7 +66,7 @@ "collection_relationships": { "AlbumArtist": { "column_mapping": { - "ArtistId": "ArtistId" + "ArtistId": ["ArtistId"] }, "relationship_type": "object", "target_collection": "Artist", @@ -74,7 +74,7 @@ }, "TrackAlbum": { "column_mapping": { - "AlbumId": "AlbumId" + "AlbumId": ["AlbumId"] }, "relationship_type": "object", "target_collection": "Album", diff --git a/crates/tests/tests-common/goldenfiles/sorting_by_nested_relationship_column_with_predicate_exists.json b/crates/tests/tests-common/goldenfiles/sorting_by_nested_relationship_column_with_predicate_exists.json index 3fe436185..deea0f950 100644 --- a/crates/tests/tests-common/goldenfiles/sorting_by_nested_relationship_column_with_predicate_exists.json +++ b/crates/tests/tests-common/goldenfiles/sorting_by_nested_relationship_column_with_predicate_exists.json @@ -74,7 +74,7 @@ "collection_relationships": { "AlbumArtist": { "column_mapping": { - "ArtistId": "ArtistId" + "ArtistId": ["ArtistId"] }, "relationship_type": "object", "target_collection": "Artist", @@ -82,7 +82,7 @@ }, "TrackAlbum": { "column_mapping": { - "AlbumId": "AlbumId" + "AlbumId": ["AlbumId"] }, "relationship_type": "object", "target_collection": "Album", diff --git a/crates/tests/tests-common/goldenfiles/sorting_by_nested_relationship_count.json b/crates/tests/tests-common/goldenfiles/sorting_by_nested_relationship_count.json index 2d257dd0d..53f1893b3 100644 --- a/crates/tests/tests-common/goldenfiles/sorting_by_nested_relationship_count.json +++ b/crates/tests/tests-common/goldenfiles/sorting_by_nested_relationship_count.json @@ -69,7 +69,10 @@ { "order_direction": "desc", "target": { - "type": "star_count_aggregate", + "type": "aggregate", + "aggregate": { + "type": "star_count" + }, "path": [ { "relationship": "ArtistAlbums", @@ -107,7 +110,7 @@ "collection_relationships": { "ArtistAlbums": { "column_mapping": { - "ArtistId": "ArtistId" + "ArtistId": ["ArtistId"] }, "relationship_type": "array", "target_collection": "Album", @@ -115,7 +118,7 @@ }, "AlbumTracks": { "column_mapping": { - "AlbumId": "AlbumId" + "AlbumId": ["AlbumId"] }, "relationship_type": "array", "target_collection": "Track", diff --git a/crates/tests/tests-common/goldenfiles/sorting_by_relationship_count_with_predicate.json b/crates/tests/tests-common/goldenfiles/sorting_by_relationship_count_with_predicate.json index 634fdc63b..b487bf3d8 100644 --- a/crates/tests/tests-common/goldenfiles/sorting_by_relationship_count_with_predicate.json +++ b/crates/tests/tests-common/goldenfiles/sorting_by_relationship_count_with_predicate.json @@ -15,7 +15,10 @@ { "order_direction": "desc", "target": { - "type": "star_count_aggregate", + "type": "aggregate", + "aggregate": { + "type": "star_count" + }, "path": [ { "relationship": "ArtistAlbums", @@ -65,7 +68,7 @@ "collection_relationships": { "ArtistAlbums": { "column_mapping": { - "ArtistId": "ArtistId" + "ArtistId": ["ArtistId"] }, "relationship_type": "array", "target_collection": "Album", @@ -73,7 +76,7 @@ }, "AlbumTracks": { "column_mapping": { - "AlbumId": "AlbumId" + "AlbumId": ["AlbumId"] }, "relationship_type": "array", "target_collection": "Track", diff --git a/crates/tests/tests-common/goldenfiles/very_nested_recursive_relationship.json b/crates/tests/tests-common/goldenfiles/very_nested_recursive_relationship.json index 7724caef9..db2e076df 100644 --- a/crates/tests/tests-common/goldenfiles/very_nested_recursive_relationship.json +++ b/crates/tests/tests-common/goldenfiles/very_nested_recursive_relationship.json @@ -110,7 +110,7 @@ "collection_relationships": { "ArtistAlbums": { "column_mapping": { - "ArtistId": "ArtistId" + "ArtistId": ["ArtistId"] }, "relationship_type": "array", "target_collection": "Album", @@ -118,7 +118,7 @@ }, "AlbumArtist": { "column_mapping": { - "ArtistId": "ArtistId" + "ArtistId": ["ArtistId"] }, "relationship_type": "object", "target_collection": "Artist", diff --git a/crates/tests/tests-common/src/router.rs b/crates/tests/tests-common/src/router.rs index 704c638a8..5bb233d97 100644 --- a/crates/tests/tests-common/src/router.rs +++ b/crates/tests/tests-common/src/router.rs @@ -21,9 +21,9 @@ pub async fn create_router( )]); let setup = PostgresSetup::new(environment); - let state = ndc_sdk::default_main::init_server_state(setup, &absolute_configuration_directory) + let state = ndc_sdk::state::init_server_state(setup, &absolute_configuration_directory) .await .unwrap(); - ndc_sdk::default_main::create_router(state, None) + ndc_sdk::default_main::create_router(state, None, None) }