-
Notifications
You must be signed in to change notification settings - Fork 0
A few fixes, a metric f-ton of tests and CI #43
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
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| pull_request: | ||
|
|
||
| jobs: | ||
| test: | ||
| name: cargo test | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| submodules: recursive | ||
|
|
||
| - name: Install system dependencies | ||
| run: sudo apt-get update && sudo apt-get install -y clang libclang-dev | ||
|
|
||
| - name: Install Rust | ||
| uses: dtolnay/rust-toolchain@stable | ||
|
|
||
| - name: Run tests | ||
| run: cargo test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| #![allow(dead_code)] | ||
|
|
||
| use pg_raw_parse::{parse, walk::walk}; | ||
|
|
||
| pub fn run_parse_debug_case(query: &str) { | ||
| let ast = parse(query).unwrap_or_else(|err| panic!("failed to parse `{query}`: {err:?}")); | ||
| assert!(!format!("{:?}", ast).is_empty()) | ||
| } | ||
|
|
||
| pub fn run_parse_debug_cases(cases: &[&str]) { | ||
| for query in cases { | ||
| run_parse_debug_case(query); | ||
| } | ||
| } | ||
|
|
||
| pub fn run_parse_walk_case(query: &str) { | ||
| let ast = parse(query).unwrap_or_else(|err| panic!("failed to parse `{query}`: {err:?}")); | ||
| walk(ast.stmts().next().unwrap(), |node| { | ||
| assert!(!format!("{:?}", node).is_empty()); | ||
| }); | ||
| assert!(!format!("{:?}", ast).is_empty()) | ||
| } | ||
|
|
||
| pub fn run_parse_walk_cases(cases: &[&str]) { | ||
| for query in cases { | ||
| run_parse_walk_case(query); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| mod common; | ||
|
|
||
| use common::run_parse_debug_cases as run_cases; | ||
|
|
||
| #[test] | ||
| fn alter_aggregate_parses() { | ||
| run_cases(&[ | ||
| r#"ALTER AGGREGATE my_sum(integer) RENAME TO my_sum_int"#, | ||
| r#"ALTER AGGREGATE my_sum(integer) OWNER TO CURRENT_USER"#, | ||
| r#"ALTER AGGREGATE my_sum(integer) SET SCHEMA analytics"#, | ||
| ]); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| mod common; | ||
|
|
||
| use common::run_parse_debug_cases as run_cases; | ||
|
|
||
| #[test] | ||
| fn alter_collation_parses() { | ||
| run_cases(&[ | ||
| r#"ALTER COLLATION my_collation REFRESH VERSION"#, | ||
| r#"ALTER COLLATION my_collation RENAME TO my_new_collation"#, | ||
| r#"ALTER COLLATION my_collation OWNER TO CURRENT_USER"#, | ||
| r#"ALTER COLLATION my_collation SET SCHEMA public"#, | ||
| ]); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| mod common; | ||
|
|
||
| use common::run_parse_debug_cases as run_cases; | ||
|
|
||
| #[test] | ||
| fn alter_conversion_parses() { | ||
| run_cases(&[ | ||
| r#"ALTER CONVERSION my_conversion RENAME TO my_new_conversion"#, | ||
| r#"ALTER CONVERSION my_conversion OWNER TO CURRENT_USER"#, | ||
| r#"ALTER CONVERSION my_conversion SET SCHEMA public"#, | ||
| ]); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| mod common; | ||
|
|
||
| use common::run_parse_debug_cases as run_cases; | ||
|
|
||
| #[test] | ||
| fn alter_database_parses() { | ||
| run_cases(&[ | ||
| r#"ALTER DATABASE mydb WITH ALLOW_CONNECTIONS false"#, | ||
| r#"ALTER DATABASE mydb RENAME TO mydb2"#, | ||
| r#"ALTER DATABASE mydb OWNER TO CURRENT_USER"#, | ||
| r#"ALTER DATABASE mydb SET TABLESPACE fastspace"#, | ||
| r#"ALTER DATABASE mydb SET search_path TO public, extensions"#, | ||
| r#"ALTER DATABASE mydb SET work_mem = '64MB'"#, | ||
| r#"ALTER DATABASE mydb SET enable_seqscan FROM CURRENT"#, | ||
| r#"ALTER DATABASE mydb RESET work_mem"#, | ||
| r#"ALTER DATABASE mydb RESET ALL"#, | ||
| ]); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| mod common; | ||
|
|
||
| use common::run_parse_debug_cases as run_cases; | ||
|
|
||
| #[test] | ||
| fn alter_default_privileges_parses() { | ||
| run_cases(&[ | ||
| r#"ALTER DEFAULT PRIVILEGES GRANT SELECT ON TABLES TO app_user"#, | ||
| r#"ALTER DEFAULT PRIVILEGES FOR ROLE owner_role IN SCHEMA public GRANT USAGE ON TYPES TO app_user WITH GRANT OPTION"#, | ||
| r#"ALTER DEFAULT PRIVILEGES IN SCHEMA public REVOKE GRANT OPTION FOR SELECT ON TABLES FROM app_user CASCADE"#, | ||
| r#"ALTER DEFAULT PRIVILEGES REVOKE EXECUTE ON ROUTINES FROM PUBLIC RESTRICT"#, | ||
| ]); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| mod common; | ||
|
|
||
| use common::run_parse_debug_cases as run_cases; | ||
|
|
||
| #[test] | ||
| fn alter_domain_parses() { | ||
| run_cases(&[ | ||
| r#"ALTER DOMAIN email_domain SET DEFAULT 'unknown@example.com'"#, | ||
| r#"ALTER DOMAIN email_domain DROP DEFAULT"#, | ||
| r#"ALTER DOMAIN email_domain SET NOT NULL"#, | ||
| r#"ALTER DOMAIN email_domain DROP NOT NULL"#, | ||
| r#"ALTER DOMAIN email_domain ADD CONSTRAINT email_check CHECK (VALUE LIKE '%@%') NOT VALID"#, | ||
| r#"ALTER DOMAIN email_domain DROP CONSTRAINT IF EXISTS email_check CASCADE"#, | ||
| r#"ALTER DOMAIN email_domain RENAME CONSTRAINT email_check TO email_check_new"#, | ||
| r#"ALTER DOMAIN email_domain VALIDATE CONSTRAINT email_check"#, | ||
| r#"ALTER DOMAIN email_domain OWNER TO CURRENT_USER"#, | ||
| r#"ALTER DOMAIN email_domain RENAME TO email_domain_new"#, | ||
| r#"ALTER DOMAIN email_domain SET SCHEMA public"#, | ||
| ]); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| mod common; | ||
|
|
||
| use common::run_parse_debug_cases as run_cases; | ||
|
|
||
| #[test] | ||
| fn alter_event_trigger_parses() { | ||
| run_cases(&[ | ||
| r#"ALTER EVENT TRIGGER trg DISABLE"#, | ||
| r#"ALTER EVENT TRIGGER trg ENABLE"#, | ||
| r#"ALTER EVENT TRIGGER trg ENABLE REPLICA"#, | ||
| r#"ALTER EVENT TRIGGER trg ENABLE ALWAYS"#, | ||
| r#"ALTER EVENT TRIGGER trg OWNER TO CURRENT_USER"#, | ||
| r#"ALTER EVENT TRIGGER trg RENAME TO trg_new"#, | ||
| ]); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| mod common; | ||
|
|
||
| use common::run_parse_debug_cases as run_cases; | ||
|
|
||
| #[test] | ||
| fn alter_extension_parses() { | ||
| run_cases(&[ | ||
| r#"ALTER EXTENSION hstore UPDATE"#, | ||
| r#"ALTER EXTENSION hstore UPDATE TO '1.8'"#, | ||
| r#"ALTER EXTENSION hstore SET SCHEMA public"#, | ||
| r#"ALTER EXTENSION hstore ADD TABLE my_table"#, | ||
| r#"ALTER EXTENSION hstore DROP FUNCTION my_function(integer)"#, | ||
| ]); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| mod common; | ||
|
|
||
| use common::run_parse_debug_cases as run_cases; | ||
|
|
||
| #[test] | ||
| fn alter_foreign_data_wrapper_parses() { | ||
| run_cases(&[ | ||
| r#"ALTER FOREIGN DATA WRAPPER my_fdw HANDLER my_handler"#, | ||
| r#"ALTER FOREIGN DATA WRAPPER my_fdw NO HANDLER"#, | ||
| r#"ALTER FOREIGN DATA WRAPPER my_fdw VALIDATOR my_validator"#, | ||
| r#"ALTER FOREIGN DATA WRAPPER my_fdw NO VALIDATOR"#, | ||
| r#"ALTER FOREIGN DATA WRAPPER my_fdw OPTIONS (ADD host 'localhost', SET port '5432', DROP oldopt)"#, | ||
| r#"ALTER FOREIGN DATA WRAPPER my_fdw OWNER TO CURRENT_USER"#, | ||
| r#"ALTER FOREIGN DATA WRAPPER my_fdw RENAME TO my_fdw_new"#, | ||
| ]); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| mod common; | ||
|
|
||
| use common::run_parse_debug_cases as run_cases; | ||
|
|
||
| #[test] | ||
| fn alter_foreign_table_parses() { | ||
| run_cases(&[ | ||
| r#"ALTER FOREIGN TABLE IF EXISTS ONLY ft ADD COLUMN IF NOT EXISTS payload text OPTIONS (column_name 'payload')"#, | ||
| r#"ALTER FOREIGN TABLE ft DROP COLUMN IF EXISTS old_col CASCADE"#, | ||
| r#"ALTER FOREIGN TABLE ft ALTER COLUMN payload TYPE varchar(200)"#, | ||
| r#"ALTER FOREIGN TABLE ft ALTER COLUMN payload SET DEFAULT 'x'"#, | ||
| r#"ALTER FOREIGN TABLE ft ALTER COLUMN payload DROP DEFAULT"#, | ||
| r#"ALTER FOREIGN TABLE ft ALTER COLUMN payload SET NOT NULL"#, | ||
| r#"ALTER FOREIGN TABLE ft ALTER COLUMN payload DROP NOT NULL"#, | ||
| r#"ALTER FOREIGN TABLE ft ALTER COLUMN payload SET STATISTICS 100"#, | ||
| r#"ALTER FOREIGN TABLE ft ADD CHECK (payload <> '') NOT VALID"#, | ||
| r#"ALTER FOREIGN TABLE ft VALIDATE CONSTRAINT payload_check"#, | ||
| r#"ALTER FOREIGN TABLE ft DROP CONSTRAINT IF EXISTS payload_check RESTRICT"#, | ||
| r#"ALTER FOREIGN TABLE ft DISABLE TRIGGER ALL"#, | ||
| r#"ALTER FOREIGN TABLE ft ENABLE ALWAYS TRIGGER trg"#, | ||
| r#"ALTER FOREIGN TABLE ft SET WITHOUT OIDS"#, | ||
| r#"ALTER FOREIGN TABLE ft OWNER TO CURRENT_USER"#, | ||
| r#"ALTER FOREIGN TABLE ft OPTIONS (ADD schema_name 'public', SET table_name 'remote_table')"#, | ||
| r#"ALTER FOREIGN TABLE ft RENAME COLUMN payload TO body"#, | ||
| r#"ALTER FOREIGN TABLE ft RENAME TO ft_new"#, | ||
| r#"ALTER FOREIGN TABLE ft SET SCHEMA archive"#, | ||
| ]); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| mod common; | ||
|
|
||
| use common::run_parse_debug_cases as run_cases; | ||
|
|
||
| #[test] | ||
| fn alter_function_parses() { | ||
| run_cases(&[ | ||
| r#"ALTER FUNCTION my_function(integer) CALLED ON NULL INPUT"#, | ||
| r#"ALTER FUNCTION my_function(integer) RETURNS NULL ON NULL INPUT"#, | ||
| r#"ALTER FUNCTION my_function(integer) STRICT"#, | ||
| r#"ALTER FUNCTION my_function(integer) IMMUTABLE PARALLEL SAFE COST 5 ROWS 10 SET search_path TO public"#, | ||
| r#"ALTER FUNCTION my_function(integer) RESET ALL"#, | ||
| r#"ALTER FUNCTION my_function(integer) OWNER TO CURRENT_USER"#, | ||
| r#"ALTER FUNCTION my_function(integer) RENAME TO my_function_new"#, | ||
| r#"ALTER FUNCTION my_function(integer) SET SCHEMA public"#, | ||
| r#"ALTER FUNCTION my_function(integer) DEPENDS ON EXTENSION hstore"#, | ||
| r#"ALTER FUNCTION my_function(integer) NO DEPENDS ON EXTENSION hstore"#, | ||
| ]); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| mod common; | ||
|
|
||
| use common::run_parse_debug_cases as run_cases; | ||
|
|
||
| #[test] | ||
| fn alter_group_parses() { | ||
| run_cases(&[ | ||
| r#"ALTER GROUP old_group RENAME TO new_group"#, | ||
| r#"ALTER GROUP my_group ADD USER alice, bob"#, | ||
| r#"ALTER GROUP my_group DROP USER alice, bob"#, | ||
| ]); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| mod common; | ||
|
|
||
| use common::run_parse_debug_cases as run_cases; | ||
|
|
||
| #[test] | ||
| fn alter_index_parses() { | ||
| run_cases(&[ | ||
| r#"ALTER INDEX IF EXISTS my_index RENAME TO my_index_new"#, | ||
| r#"ALTER INDEX ALL IN TABLESPACE oldspace OWNED BY app_user SET TABLESPACE newspace NOWAIT"#, | ||
| r#"ALTER INDEX my_index ATTACH PARTITION my_index_part"#, | ||
| r#"ALTER INDEX my_index DEPENDS ON EXTENSION hstore"#, | ||
| r#"ALTER INDEX my_index NO DEPENDS ON EXTENSION hstore"#, | ||
| r#"ALTER INDEX my_index SET TABLESPACE fastspace"#, | ||
| r#"ALTER INDEX my_index SET (fillfactor = 80, deduplicate_items = off)"#, | ||
| r#"ALTER INDEX my_index RESET (fillfactor)"#, | ||
| r#"ALTER INDEX my_index ALTER COLUMN 1 SET STATISTICS 100"#, | ||
| ]); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| mod common; | ||
|
|
||
| use common::run_parse_debug_cases as run_cases; | ||
|
|
||
| #[test] | ||
| fn alter_language_parses() { | ||
| run_cases(&[ | ||
| r#"ALTER LANGUAGE plsample RENAME TO plsample2"#, | ||
| r#"ALTER LANGUAGE plsample OWNER TO CURRENT_USER"#, | ||
| ]); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| mod common; | ||
|
|
||
| use common::run_parse_debug_cases as run_cases; | ||
|
|
||
| #[test] | ||
| fn alter_large_object_parses() { | ||
| run_cases(&[r#"ALTER LARGE OBJECT 12345 OWNER TO CURRENT_USER"#]); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| mod common; | ||
|
|
||
| use common::run_parse_debug_cases as run_cases; | ||
|
|
||
| #[test] | ||
| fn alter_materialized_view_parses() { | ||
| run_cases(&[ | ||
| r#"ALTER MATERIALIZED VIEW IF EXISTS mv RENAME TO mv_new"#, | ||
| r#"ALTER MATERIALIZED VIEW mv ALTER COLUMN col SET STATISTICS 100"#, | ||
| r#"ALTER MATERIALIZED VIEW mv ALTER COLUMN col SET (n_distinct = 10)"#, | ||
| r#"ALTER MATERIALIZED VIEW mv ALTER COLUMN col RESET (n_distinct)"#, | ||
| r#"ALTER MATERIALIZED VIEW mv CLUSTER ON mv_idx"#, | ||
| r#"ALTER MATERIALIZED VIEW mv SET WITHOUT CLUSTER"#, | ||
| r#"ALTER MATERIALIZED VIEW mv SET ACCESS METHOD heap"#, | ||
| r#"ALTER MATERIALIZED VIEW mv SET TABLESPACE fastspace"#, | ||
| r#"ALTER MATERIALIZED VIEW mv SET (fillfactor = 80)"#, | ||
| r#"ALTER MATERIALIZED VIEW mv RESET (fillfactor)"#, | ||
| r#"ALTER MATERIALIZED VIEW mv OWNER TO CURRENT_USER"#, | ||
| r#"ALTER MATERIALIZED VIEW mv SET SCHEMA public"#, | ||
| r#"ALTER MATERIALIZED VIEW ALL IN TABLESPACE oldspace OWNED BY app_user SET TABLESPACE newspace NOWAIT"#, | ||
| ]); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| mod common; | ||
|
|
||
| use common::run_parse_debug_cases as run_cases; | ||
|
|
||
| #[test] | ||
| fn alter_operator_parses() { | ||
| run_cases(&[ | ||
| r#"ALTER OPERATOR +(integer, integer) OWNER TO CURRENT_USER"#, | ||
| r#"ALTER OPERATOR +(integer, integer) SET SCHEMA public"#, | ||
| r#"ALTER OPERATOR +(integer, integer) SET (RESTRICT = my_restrict, JOIN = my_join)"#, | ||
| ]); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| mod common; | ||
|
|
||
| use common::run_parse_debug_cases as run_cases; | ||
|
|
||
| #[test] | ||
| fn alter_operator_class_parses() { | ||
| run_cases(&[ | ||
| r#"ALTER OPERATOR CLASS my_opclass USING btree RENAME TO my_opclass_new"#, | ||
| r#"ALTER OPERATOR CLASS my_opclass USING btree OWNER TO CURRENT_USER"#, | ||
| r#"ALTER OPERATOR CLASS my_opclass USING btree SET SCHEMA public"#, | ||
| ]); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| mod common; | ||
|
|
||
| use common::run_parse_debug_cases as run_cases; | ||
|
|
||
| #[test] | ||
| fn alter_operator_family_parses() { | ||
| run_cases(&[ | ||
| r#"ALTER OPERATOR FAMILY my_family USING btree ADD OPERATOR 1 =(integer, integer)"#, | ||
| r#"ALTER OPERATOR FAMILY my_family USING btree DROP OPERATOR 1 (integer, integer)"#, | ||
| r#"ALTER OPERATOR FAMILY my_family USING btree RENAME TO my_family_new"#, | ||
| r#"ALTER OPERATOR FAMILY my_family USING btree OWNER TO CURRENT_USER"#, | ||
| r#"ALTER OPERATOR FAMILY my_family USING btree SET SCHEMA public"#, | ||
| ]); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| mod common; | ||
|
|
||
| use common::run_parse_debug_cases as run_cases; | ||
|
|
||
| #[test] | ||
| fn alter_policy_parses() { | ||
| run_cases(&[ | ||
| r#"ALTER POLICY pol ON my_table RENAME TO pol_new"#, | ||
| r#"ALTER POLICY pol ON my_table TO app_user USING (tenant_id = 1) WITH CHECK (tenant_id = 1)"#, | ||
| ]); | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Walking is unnecessary, just debug printing the root is enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought you were worried about that one or something because it did something different. We can parse all DDL but we can't walk it for example, so I was just making sure it can walk DML