-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
only rewrite database() against dual #5793
Conversation
Signed-off-by: Andres Taylor <andres@planetscale.com>
…systay-fix-database Signed-off-by: deepthi <deepthi@planetscale.com>
Signed-off-by: deepthi <deepthi@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: deepthi <deepthi@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
6151d4c
to
6d8e867
Compare
@deepthi, You are correctly pointing out inconsistencies with the illusion we are creating when doing this query rewriting. The way I see it, we have a few choices:
Another heuristic we could use is to only rewrite Input is most welcome. |
Thank you for the detailed analysis. The current implementation seems to be the most sensible option. Even though it is inconsistent, it gives us "working" behavior for all the cases you enumerated. |
…nto systay-fix-database Signed-off-by: deepthi <deepthi@planetscale.com>
…r db name Signed-off-by: deepthi <deepthi@planetscale.com>
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
When we implemented handling of
database()
to map to keyspace_name, we didn't consider cases where the expression is part of a query that is being sent to a tablet instead of being handled in vtgate.So a query like
select database()
would return the keyspace name (which is correct), but a query likeselect table_name from information_schema.tables where table_schema = database()
would not work as expected because the table_schema doesn't match the keyspace name.This is a stopgap fix until we fully implement information_schema.
Adapted from #5787 with unit test fixes and more tests.
cc @systay