-
Notifications
You must be signed in to change notification settings - Fork 94
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
Block cross-db 'SELECT ... INTO table FROM ...' statement #2744
Block cross-db 'SELECT ... INTO table FROM ...' statement #2744
Conversation
Before this commit, Cross-db 'SELECT ... INTO table FROM ...' was allowed to be executed unintentionally since it was missed to be blocked when cross-db DMLs got supported. Due to this unblocked behaviour, It creates a table whose owner is current session's login since internally cross-db statement execution sets current role to current session's login. This commit blocks cross-db 'SELECT ... INTO table FROM ...' statement by adding relavant check on ANTLR parser. Signed-off-by: Harsh Lunagariya <[email protected]>
Pull Request Test Coverage Report for Build 10056627748Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
Signed-off-by: Harsh Lunagariya <[email protected]>
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.
LGTM
{ | ||
throw PGErrorWrapperException(ERROR, | ||
ERRCODE_FEATURE_NOT_SUPPORTED, | ||
"cross-db 'SELECT INTO' statement is not supported in Babelfish", |
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.
Nit: Should we suggest a alternative in error hint?
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.
error hint will only be logged in logfile. not sure how will it help in this case
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.
Included workaround in comment message itself as suggested by Alex.
Signed-off-by: Harsh Lunagariya <[email protected]>
dfbc593
Signed-off-by: Harsh Lunagariya <[email protected]>
1570cc6
into
babelfish-for-postgresql:BABEL_4_X_DEV
…for-postgresql#2744) Before this commit, Cross-db 'SELECT ... INTO table FROM ...' was allowed to be executed unintentionally since it was missed to be blocked when cross-db DMLs got supported. Due to this unblocked behaviour, It creates a table whose owner is current session's login since internally cross-db statement execution sets current role to current session's login. This commit blocks cross-db 'SELECT ... INTO table FROM ...' statement by adding relevant check on ANTLR parser. Task: BABEL-4934 Signed-off-by: Harsh Lunagariya [email protected]
) Before this commit, Cross-db 'SELECT ... INTO table FROM ...' was allowed to be executed unintentionally since it was missed to be blocked when cross-db DMLs got supported. Due to this unblocked behaviour, It creates a table whose owner is current session's login since internally cross-db statement execution sets current role to current session's login. This commit blocks cross-db 'SELECT ... INTO table FROM ...' statement by adding relevant check on ANTLR parser. Task: BABEL-4934 Signed-off-by: Harsh Lunagariya [email protected]
…for-postgresql#2744) Before this commit, Cross-db 'SELECT ... INTO table FROM ...' was allowed to be executed unintentionally since it was missed to be blocked when cross-db DMLs got supported. Due to this unblocked behaviour, It creates a table whose owner is current session's login since internally cross-db statement execution sets current role to current session's login. This commit blocks cross-db 'SELECT ... INTO table FROM ...' statement by adding relevant check on ANTLR parser. Task: BABEL-4934 Signed-off-by: Harsh Lunagariya [email protected]
…for-postgresql#2744) (babelfish-for-postgresql#2780) Before this commit, Cross-db 'SELECT ... INTO table FROM ...' was allowed to be executed unintentionally since it was missed to be blocked when cross-db DMLs got supported. Due to this unblocked behaviour, It creates a table whose owner is current session's login since internally cross-db statement execution sets current role to current session's login. This commit blocks cross-db 'SELECT ... INTO table FROM ...' statement by adding relevant check on ANTLR parser. Task: BABEL-4934 Signed-off-by: Harsh Lunagariya [email protected]
)" (#3109) This reverts commit 1570cc6. Task: BABEL-4934 Co-authored-by: ANJU BHARTI <[email protected]>
)" (#3112) This reverts commit 1570cc6. Task: BABEL-4934 Co-authored-by: ANJU BHARTI <[email protected]>
)" (#3111) This reverts commit 1570cc6. Task: BABEL-4934 Co-authored-by: ANJU BHARTI <[email protected]>
) (#2780)" (#3114) This reverts commit 0b401ee. Task: BABEL-4934 Signed-off-by: ANJU BHARTI <[email protected]>
) (#2780)" (#3113) This reverts commit 0b401ee. Task: BABEL-4934 Signed-off-by: ANJU BHARTI <[email protected]>
) (#2780)" (#3110) This reverts commit 1570cc6. Task: BABEL-4934 Signed-off-by: ANJU BHARTI <[email protected]>
…belfish-for-postgresql#2744)" (babelfish-for-postgresql#3109) This reverts commit 1570cc6. Task: BABEL-4934 Co-authored-by: ANJU BHARTI <[email protected]>
…belfish-for-postgresql#2744)" (babelfish-for-postgresql#3109) This reverts commit 1570cc6. Task: BABEL-4934 Co-authored-by: ANJU BHARTI <[email protected]>
…belfish-for-postgresql#2744)" (babelfish-for-postgresql#3109) This reverts commit 1570cc6. Task: BABEL-4934 Co-authored-by: ANJU BHARTI <[email protected]>
)" (#3109) This reverts commit 1570cc6. Task: BABEL-4934 Co-authored-by: ANJU BHARTI <[email protected]>
Description
Before this commit, Cross-db 'SELECT ... INTO table FROM ...' was allowed to be executed unintentionally since it was missed to be blocked when cross-db DMLs got supported. Due to this unblocked behaviour, It creates a table whose owner is current session's login since internally cross-db statement execution sets current role to current session's login.
This commit blocks cross-db 'SELECT ... INTO table FROM ...' statement by adding relevant check on ANTLR parser.
Task: BABEL-4934
Signed-off-by: Harsh Lunagariya [email protected]
Issues Resolved
BABEL-4934
Test Scenarios Covered
Use case based -
SELECT INTO query with table within same-db/cross-db
SELECT INTO temp table query
Boundary conditions -
NA
Arbitrary inputs -
NA
Negative test cases -
SELECT INTO query with table within same-db
Minor version upgrade tests -
NA
Major version upgrade tests -
NA
Performance tests -
NA
Tooling impact -
NA
Client tests -
Check List
By submitting this pull request, I confirm that my contribution is under the terms of the Apache 2.0 and PostgreSQL licenses, and grant any person obtaining a copy of the contribution permission to relicense all or a portion of my contribution to the PostgreSQL License solely to contribute all or a portion of my contribution to the PostgreSQL open source project.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.