Skip to content

Support network_supeq and network_subeq by default #541

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions crates/configuration/src/version5/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,9 @@ fn default_introspect_prefix_function_comparison_operators() -> Vec<String> {
"lseg_perp".to_string(),
"network_overlap".to_string(),
"network_sub".to_string(),
"network_subeq".to_string(),
"network_sup".to_string(),
"network_supeq".to_string(),
"on_pb".to_string(),
Comment on lines 157 to 161
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

"on_pl".to_string(),
"on_ppath".to_string(),
Expand Down
6 changes: 6 additions & 0 deletions crates/tests/databases-tests/src/postgres/query_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,12 @@ mod predicates {
insta::assert_json_snapshot!(result);
}

#[tokio::test]
async fn where_cidr_network_supeq() {
let result = run_query(create_router().await, "where_cidr_network_supeq").await;
insta::assert_json_snapshot!(result);
}

#[tokio::test]
async fn select_where_or() {
let result = run_query(create_router().await, "select_where_or").await;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -883,6 +883,31 @@ expression: default_configuration
"foreignRelations": {},
"description": null
},
"custom_test_cidr": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit weird that we also update v3 and v4 test snapshots for this change, but I suppose it follows from each version using sharing the same test database definition.

"schemaName": "custom",
"tableName": "test_cidr",
"columns": {
"ip": {
"name": "ip",
"type": {
"scalarType": "cidr"
},
"nullable": "nullable",
"description": null
},
"service": {
"name": "service",
"type": {
"scalarType": "text"
},
"nullable": "nullable",
"description": null
}
},
"uniquenessConstraints": {},
"foreignRelations": {},
"description": null
},
"deck_of_cards": {
"schemaName": "public",
"tableName": "deck_of_cards",
Expand Down Expand Up @@ -1282,6 +1307,14 @@ expression: default_configuration
"returnType": "card_suit"
}
},
"cidr": {
"max": {
"returnType": "inet"
},
"min": {
"returnType": "inet"
}
},
"date": {
"max": {
"returnType": "date"
Expand Down Expand Up @@ -1760,6 +1793,74 @@ expression: default_configuration
"isInfix": true
}
},
"cidr": {
"_eq": {
"operatorName": "=",
"operatorKind": "equal",
"argumentType": "cidr",
"isInfix": true
},
"_gt": {
"operatorName": ">",
"operatorKind": "custom",
"argumentType": "cidr",
"isInfix": true
},
"_gte": {
"operatorName": ">=",
"operatorKind": "custom",
"argumentType": "cidr",
"isInfix": true
},
"_in": {
"operatorName": "IN",
"operatorKind": "in",
"argumentType": "cidr",
"isInfix": true
},
"_lt": {
"operatorName": "<",
"operatorKind": "custom",
"argumentType": "cidr",
"isInfix": true
},
"_lte": {
"operatorName": "<=",
"operatorKind": "custom",
"argumentType": "cidr",
"isInfix": true
},
"_neq": {
"operatorName": "<>",
"operatorKind": "custom",
"argumentType": "cidr",
"isInfix": true
},
"inet_same_family": {
"operatorName": "inet_same_family",
"operatorKind": "custom",
"argumentType": "cidr",
"isInfix": false
},
"network_overlap": {
"operatorName": "network_overlap",
"operatorKind": "custom",
"argumentType": "cidr",
"isInfix": false
},
"network_sub": {
"operatorName": "network_sub",
"operatorKind": "custom",
"argumentType": "cidr",
"isInfix": false
},
"network_sup": {
"operatorName": "network_sup",
"operatorKind": "custom",
"argumentType": "cidr",
"isInfix": false
}
},
"date": {
"_eq": {
"operatorName": "=",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -883,6 +883,31 @@ expression: default_configuration
"foreignRelations": {},
"description": null
},
"custom_test_cidr": {
"schemaName": "custom",
"tableName": "test_cidr",
"columns": {
"ip": {
"name": "ip",
"type": {
"scalarType": "cidr"
},
"nullable": "nullable",
"description": null
},
"service": {
"name": "service",
"type": {
"scalarType": "text"
},
"nullable": "nullable",
"description": null
}
},
"uniquenessConstraints": {},
"foreignRelations": {},
"description": null
},
"deck_of_cards": {
"schemaName": "public",
"tableName": "deck_of_cards",
Expand Down Expand Up @@ -1465,6 +1490,88 @@ expression: default_configuration
]
}
},
"cidr": {
"typeName": "cidr",
"schemaName": "pg_catalog",
"description": null,
"aggregateFunctions": {
"max": {
"returnType": "inet"
},
"min": {
"returnType": "inet"
}
},
"comparisonOperators": {
"_eq": {
"operatorName": "=",
"operatorKind": "equal",
"argumentType": "cidr",
"isInfix": true
},
"_gt": {
"operatorName": ">",
"operatorKind": "custom",
"argumentType": "cidr",
"isInfix": true
},
"_gte": {
"operatorName": ">=",
"operatorKind": "custom",
"argumentType": "cidr",
"isInfix": true
},
"_in": {
"operatorName": "IN",
"operatorKind": "in",
"argumentType": "cidr",
"isInfix": true
},
"_lt": {
"operatorName": "<",
"operatorKind": "custom",
"argumentType": "cidr",
"isInfix": true
},
"_lte": {
"operatorName": "<=",
"operatorKind": "custom",
"argumentType": "cidr",
"isInfix": true
},
"_neq": {
"operatorName": "<>",
"operatorKind": "custom",
"argumentType": "cidr",
"isInfix": true
},
"inet_same_family": {
"operatorName": "inet_same_family",
"operatorKind": "custom",
"argumentType": "cidr",
"isInfix": false
},
"network_overlap": {
"operatorName": "network_overlap",
"operatorKind": "custom",
"argumentType": "cidr",
"isInfix": false
},
"network_sub": {
"operatorName": "network_sub",
"operatorKind": "custom",
"argumentType": "cidr",
"isInfix": false
},
"network_sup": {
"operatorName": "network_sup",
"operatorKind": "custom",
"argumentType": "cidr",
"isInfix": false
}
},
"typeRepresentation": null
},
"date": {
"typeName": "date",
"schemaName": "pg_catalog",
Expand Down Expand Up @@ -1696,6 +1803,88 @@ expression: default_configuration
},
"typeRepresentation": "float64"
},
"inet": {
"typeName": "inet",
"schemaName": "pg_catalog",
"description": null,
"aggregateFunctions": {
"max": {
"returnType": "inet"
},
"min": {
"returnType": "inet"
}
},
"comparisonOperators": {
"_eq": {
"operatorName": "=",
"operatorKind": "equal",
"argumentType": "inet",
"isInfix": true
},
"_gt": {
"operatorName": ">",
"operatorKind": "custom",
"argumentType": "inet",
"isInfix": true
},
"_gte": {
"operatorName": ">=",
"operatorKind": "custom",
"argumentType": "inet",
"isInfix": true
},
"_in": {
"operatorName": "IN",
"operatorKind": "in",
"argumentType": "inet",
"isInfix": true
},
"_lt": {
"operatorName": "<",
"operatorKind": "custom",
"argumentType": "inet",
"isInfix": true
},
"_lte": {
"operatorName": "<=",
"operatorKind": "custom",
"argumentType": "inet",
"isInfix": true
},
"_neq": {
"operatorName": "<>",
"operatorKind": "custom",
"argumentType": "inet",
"isInfix": true
},
"inet_same_family": {
"operatorName": "inet_same_family",
"operatorKind": "custom",
"argumentType": "inet",
"isInfix": false
},
"network_overlap": {
"operatorName": "network_overlap",
"operatorKind": "custom",
"argumentType": "inet",
"isInfix": false
},
"network_sub": {
"operatorName": "network_sub",
"operatorKind": "custom",
"argumentType": "inet",
"isInfix": false
},
"network_sup": {
"operatorName": "network_sup",
"operatorKind": "custom",
"argumentType": "inet",
"isInfix": false
}
},
"typeRepresentation": null
},
"int2": {
"typeName": "int2",
"schemaName": "pg_catalog",
Expand Down
Loading