Skip to content

Commit b331d5a

Browse files
Used pg_and_generic instead of pg where possible
1 parent 52c440c commit b331d5a

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

tests/sqlparser_postgres.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6976,11 +6976,11 @@ fn parse_drop_operator_family() {
69766976

69776977
// Test error: DROP OPERATOR FAMILY with no names
69786978
let sql = "DROP OPERATOR FAMILY USING btree";
6979-
assert!(pg().parse_sql_statements(sql).is_err());
6979+
assert!(pg_and_generic().parse_sql_statements(sql).is_err());
69806980

69816981
// Test error: DROP OPERATOR FAMILY IF EXISTS with no names
69826982
let sql = "DROP OPERATOR FAMILY IF EXISTS USING btree";
6983-
assert!(pg().parse_sql_statements(sql).is_err());
6983+
assert!(pg_and_generic().parse_sql_statements(sql).is_err());
69846984
}
69856985

69866986
#[test]
@@ -7039,18 +7039,18 @@ fn parse_drop_operator_class() {
70397039

70407040
// Test error: DROP OPERATOR CLASS with no names
70417041
let sql = "DROP OPERATOR CLASS USING btree";
7042-
assert!(pg().parse_sql_statements(sql).is_err());
7042+
assert!(pg_and_generic().parse_sql_statements(sql).is_err());
70437043

70447044
// Test error: DROP OPERATOR CLASS IF EXISTS with no names
70457045
let sql = "DROP OPERATOR CLASS IF EXISTS USING btree";
7046-
assert!(pg().parse_sql_statements(sql).is_err());
7046+
assert!(pg_and_generic().parse_sql_statements(sql).is_err());
70477047
}
70487048

70497049
#[test]
70507050
fn parse_create_operator_family() {
70517051
for index_method in &["btree", "hash", "gist", "gin", "spgist", "brin"] {
70527052
assert_eq!(
7053-
pg().verified_stmt(&format!(
7053+
pg_and_generic().verified_stmt(&format!(
70547054
"CREATE OPERATOR FAMILY my_family USING {index_method}"
70557055
)),
70567056
Statement::CreateOperatorFamily(CreateOperatorFamily {
@@ -7059,7 +7059,7 @@ fn parse_create_operator_family() {
70597059
})
70607060
);
70617061
assert_eq!(
7062-
pg().verified_stmt(&format!(
7062+
pg_and_generic().verified_stmt(&format!(
70637063
"CREATE OPERATOR FAMILY myschema.test_family USING {index_method}"
70647064
)),
70657065
Statement::CreateOperatorFamily(CreateOperatorFamily {
@@ -7085,7 +7085,7 @@ fn parse_create_operator_class() {
70857085
let sql = format!(
70867086
"CREATE OPERATOR CLASS {class_name} {default_clause}FOR TYPE INT4 USING btree{family_clause} AS OPERATOR 1 <"
70877087
);
7088-
match pg().verified_stmt(&sql) {
7088+
match pg_and_generic().verified_stmt(&sql) {
70897089
Statement::CreateOperatorClass(CreateOperatorClass {
70907090
name,
70917091
default,
@@ -7115,7 +7115,7 @@ fn parse_create_operator_class() {
71157115
}
71167116

71177117
// Test comprehensive operator class with all fields
7118-
match pg().verified_stmt("CREATE OPERATOR CLASS CAS_btree_ops DEFAULT FOR TYPE CAS USING btree FAMILY CAS_btree_ops AS OPERATOR 1 <, OPERATOR 2 <=, OPERATOR 3 =, OPERATOR 4 >=, OPERATOR 5 >, FUNCTION 1 cas_cmp(CAS, CAS)") {
7118+
match pg_and_generic().verified_stmt("CREATE OPERATOR CLASS CAS_btree_ops DEFAULT FOR TYPE CAS USING btree FAMILY CAS_btree_ops AS OPERATOR 1 <, OPERATOR 2 <=, OPERATOR 3 =, OPERATOR 4 >=, OPERATOR 5 >, FUNCTION 1 cas_cmp(CAS, CAS)") {
71197119
Statement::CreateOperatorClass(CreateOperatorClass {
71207120
name,
71217121
default: true,
@@ -7134,7 +7134,7 @@ fn parse_create_operator_class() {
71347134
}
71357135

71367136
// Test operator with argument types
7137-
match pg().verified_stmt(
7137+
match pg_and_generic().verified_stmt(
71387138
"CREATE OPERATOR CLASS test_ops FOR TYPE INT4 USING gist AS OPERATOR 1 < (INT4, INT4)",
71397139
) {
71407140
Statement::CreateOperatorClass(CreateOperatorClass { ref items, .. }) => {
@@ -7159,7 +7159,7 @@ fn parse_create_operator_class() {
71597159
}
71607160

71617161
// Test operator FOR SEARCH
7162-
match pg().verified_stmt(
7162+
match pg_and_generic().verified_stmt(
71637163
"CREATE OPERATOR CLASS test_ops FOR TYPE INT4 USING gist AS OPERATOR 1 < FOR SEARCH",
71647164
) {
71657165
Statement::CreateOperatorClass(CreateOperatorClass { ref items, .. }) => {
@@ -7203,7 +7203,7 @@ fn parse_create_operator_class() {
72037203
}
72047204

72057205
// Test function with operator class arg types
7206-
match pg().verified_stmt("CREATE OPERATOR CLASS test_ops FOR TYPE INT4 USING btree AS FUNCTION 1 (INT4, INT4) btcmp(INT4, INT4)") {
7206+
match pg_and_generic().verified_stmt("CREATE OPERATOR CLASS test_ops FOR TYPE INT4 USING btree AS FUNCTION 1 (INT4, INT4) btcmp(INT4, INT4)") {
72077207
Statement::CreateOperatorClass(CreateOperatorClass {
72087208
ref items,
72097209
..
@@ -7226,11 +7226,11 @@ fn parse_create_operator_class() {
72267226
}
72277227

72287228
// Test function with no arguments (empty parentheses normalizes to no parentheses)
7229-
pg().one_statement_parses_to(
7229+
pg_and_generic().one_statement_parses_to(
72307230
"CREATE OPERATOR CLASS test_ops FOR TYPE INT4 USING btree AS FUNCTION 1 my_func()",
72317231
"CREATE OPERATOR CLASS test_ops FOR TYPE INT4 USING btree AS FUNCTION 1 my_func",
72327232
);
7233-
match pg().verified_stmt(
7233+
match pg_and_generic().verified_stmt(
72347234
"CREATE OPERATOR CLASS test_ops FOR TYPE INT4 USING btree AS FUNCTION 1 my_func",
72357235
) {
72367236
Statement::CreateOperatorClass(CreateOperatorClass { ref items, .. }) => {
@@ -7255,7 +7255,7 @@ fn parse_create_operator_class() {
72557255
}
72567256

72577257
// Test multiple items including STORAGE
7258-
match pg().verified_stmt("CREATE OPERATOR CLASS gist_ops FOR TYPE geometry USING gist AS OPERATOR 1 <<, FUNCTION 1 gist_consistent(internal, geometry, INT4), STORAGE box") {
7258+
match pg_and_generic().verified_stmt("CREATE OPERATOR CLASS gist_ops FOR TYPE geometry USING gist AS OPERATOR 1 <<, FUNCTION 1 gist_consistent(internal, geometry, INT4), STORAGE box") {
72597259
Statement::CreateOperatorClass(CreateOperatorClass {
72607260
ref items,
72617261
..

0 commit comments

Comments
 (0)