-
Notifications
You must be signed in to change notification settings - Fork 56
fix: support other 'booly' values for opts bool #493
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
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5895316
refactor: make parser tests integration tests
psteinroe caae409
Merge branch 'master' into refactor/parser-integration-tests
psteinroe d1d4c0e
Merge branch 'master' into refactor/parser-integration-tests
psteinroe 4f37f2b
chore: setup regression test suite
psteinroe a57bac8
properly ignore
psteinroe b75b1f3
merge main
psteinroe 2ca0eb9
fix: support other 'booly' values for opts bool
psteinroe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
148 changes: 148 additions & 0 deletions
148
crates/squawk_parser/tests/data/regression_suite/advisory_lock.sql
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,148 @@ | ||
| -- | ||
| -- ADVISORY LOCKS | ||
| -- | ||
|
|
||
| SELECT oid AS datoid FROM pg_database WHERE datname = current_database() ; | ||
|
|
||
| BEGIN; | ||
|
|
||
| SELECT | ||
| pg_advisory_xact_lock(1), pg_advisory_xact_lock_shared(2), | ||
| pg_advisory_xact_lock(1, 1), pg_advisory_xact_lock_shared(2, 2); | ||
|
|
||
| SELECT locktype, classid, objid, objsubid, mode, granted | ||
| FROM pg_locks WHERE locktype = 'advisory' AND database = 'datoid' | ||
| ORDER BY classid, objid, objsubid; | ||
|
|
||
|
|
||
| -- pg_advisory_unlock_all() shouldn't release xact locks | ||
| SELECT pg_advisory_unlock_all(); | ||
|
|
||
| SELECT count(*) FROM pg_locks WHERE locktype = 'advisory' AND database = 'datoid'; | ||
|
|
||
|
|
||
| -- can't unlock xact locks | ||
| SELECT | ||
| pg_advisory_unlock(1), pg_advisory_unlock_shared(2), | ||
| pg_advisory_unlock(1, 1), pg_advisory_unlock_shared(2, 2); | ||
|
|
||
|
|
||
| -- automatically release xact locks at commit | ||
| COMMIT; | ||
|
|
||
| SELECT count(*) FROM pg_locks WHERE locktype = 'advisory' AND database = 'datoid'; | ||
|
|
||
|
|
||
| BEGIN; | ||
|
|
||
| -- holding both session and xact locks on the same objects, xact first | ||
| SELECT | ||
| pg_advisory_xact_lock(1), pg_advisory_xact_lock_shared(2), | ||
| pg_advisory_xact_lock(1, 1), pg_advisory_xact_lock_shared(2, 2); | ||
|
|
||
| SELECT locktype, classid, objid, objsubid, mode, granted | ||
| FROM pg_locks WHERE locktype = 'advisory' AND database = 'datoid' | ||
| ORDER BY classid, objid, objsubid; | ||
|
|
||
| SELECT | ||
| pg_advisory_lock(1), pg_advisory_lock_shared(2), | ||
| pg_advisory_lock(1, 1), pg_advisory_lock_shared(2, 2); | ||
|
|
||
| ROLLBACK; | ||
|
|
||
| SELECT locktype, classid, objid, objsubid, mode, granted | ||
| FROM pg_locks WHERE locktype = 'advisory' AND database = 'datoid' | ||
| ORDER BY classid, objid, objsubid; | ||
|
|
||
|
|
||
| -- unlocking session locks | ||
| SELECT | ||
| pg_advisory_unlock(1), pg_advisory_unlock(1), | ||
| pg_advisory_unlock_shared(2), pg_advisory_unlock_shared(2), | ||
| pg_advisory_unlock(1, 1), pg_advisory_unlock(1, 1), | ||
| pg_advisory_unlock_shared(2, 2), pg_advisory_unlock_shared(2, 2); | ||
|
|
||
| SELECT count(*) FROM pg_locks WHERE locktype = 'advisory' AND database = 'datoid'; | ||
|
|
||
|
|
||
| BEGIN; | ||
|
|
||
| -- holding both session and xact locks on the same objects, session first | ||
| SELECT | ||
| pg_advisory_lock(1), pg_advisory_lock_shared(2), | ||
| pg_advisory_lock(1, 1), pg_advisory_lock_shared(2, 2); | ||
|
|
||
| SELECT locktype, classid, objid, objsubid, mode, granted | ||
| FROM pg_locks WHERE locktype = 'advisory' AND database = 'datoid' | ||
| ORDER BY classid, objid, objsubid; | ||
|
|
||
| SELECT | ||
| pg_advisory_xact_lock(1), pg_advisory_xact_lock_shared(2), | ||
| pg_advisory_xact_lock(1, 1), pg_advisory_xact_lock_shared(2, 2); | ||
|
|
||
| ROLLBACK; | ||
|
|
||
| SELECT locktype, classid, objid, objsubid, mode, granted | ||
| FROM pg_locks WHERE locktype = 'advisory' AND database = 'datoid' | ||
| ORDER BY classid, objid, objsubid; | ||
|
|
||
|
|
||
| -- releasing all session locks | ||
| SELECT pg_advisory_unlock_all(); | ||
|
|
||
| SELECT count(*) FROM pg_locks WHERE locktype = 'advisory' AND database = 'datoid'; | ||
|
|
||
|
|
||
| BEGIN; | ||
|
|
||
| -- grabbing txn locks multiple times | ||
|
|
||
| SELECT | ||
| pg_advisory_xact_lock(1), pg_advisory_xact_lock(1), | ||
| pg_advisory_xact_lock_shared(2), pg_advisory_xact_lock_shared(2), | ||
| pg_advisory_xact_lock(1, 1), pg_advisory_xact_lock(1, 1), | ||
| pg_advisory_xact_lock_shared(2, 2), pg_advisory_xact_lock_shared(2, 2); | ||
|
|
||
| SELECT locktype, classid, objid, objsubid, mode, granted | ||
| FROM pg_locks WHERE locktype = 'advisory' AND database = 'datoid' | ||
| ORDER BY classid, objid, objsubid; | ||
|
|
||
| COMMIT; | ||
|
|
||
| SELECT count(*) FROM pg_locks WHERE locktype = 'advisory' AND database = 'datoid'; | ||
|
|
||
| -- grabbing session locks multiple times | ||
|
|
||
| SELECT | ||
| pg_advisory_lock(1), pg_advisory_lock(1), | ||
| pg_advisory_lock_shared(2), pg_advisory_lock_shared(2), | ||
| pg_advisory_lock(1, 1), pg_advisory_lock(1, 1), | ||
| pg_advisory_lock_shared(2, 2), pg_advisory_lock_shared(2, 2); | ||
|
|
||
| SELECT locktype, classid, objid, objsubid, mode, granted | ||
| FROM pg_locks WHERE locktype = 'advisory' AND database = 'datoid' | ||
| ORDER BY classid, objid, objsubid; | ||
|
|
||
| SELECT | ||
| pg_advisory_unlock(1), pg_advisory_unlock(1), | ||
| pg_advisory_unlock_shared(2), pg_advisory_unlock_shared(2), | ||
| pg_advisory_unlock(1, 1), pg_advisory_unlock(1, 1), | ||
| pg_advisory_unlock_shared(2, 2), pg_advisory_unlock_shared(2, 2); | ||
|
|
||
| SELECT count(*) FROM pg_locks WHERE locktype = 'advisory' AND database = 'datoid'; | ||
|
|
||
| -- .. and releasing them all at once | ||
|
|
||
| SELECT | ||
| pg_advisory_lock(1), pg_advisory_lock(1), | ||
| pg_advisory_lock_shared(2), pg_advisory_lock_shared(2), | ||
| pg_advisory_lock(1, 1), pg_advisory_lock(1, 1), | ||
| pg_advisory_lock_shared(2, 2), pg_advisory_lock_shared(2, 2); | ||
|
|
||
| SELECT locktype, classid, objid, objsubid, mode, granted | ||
| FROM pg_locks WHERE locktype = 'advisory' AND database = 'datoid' | ||
| ORDER BY classid, objid, objsubid; | ||
|
|
||
| SELECT pg_advisory_unlock_all(); | ||
|
|
||
| SELECT count(*) FROM pg_locks WHERE locktype = 'advisory' AND database = 'datoid'; |
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.
yeah we can add a validation for that in crates/squawk_syntax/src/validations.rs
which is layered on top of this, the parser doesn't know about actual values, so we can't really check here