-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
sql: Map SHOW statements onto queries from information_schema #9966
Comments
@nvanbenschoten Maybe I can help to fix it.
|
Hi @yznming, that's correct. The goal here is for each of the statements in Your help would be very welcomed! As a first step, I would recommend writing out here the SQL query you intend to perform for each SHOW statement (ie. |
@yznming yes that's the idea. |
@nvanbenschoten @knz Here is my analysis. I would appreciate if you could suggest more advice here, thanks.
|
This looks like a great start, nice job! A few pointers that might help as you continue working on the last few statments are:
Let me know if you have any questions or if there are any statements you're finding particularly tricky. |
@nvanbenschoten thanks a lot. still have a few questions:
|
To execute the statements it's simpler than that. See this comment: Something like: func (p *planner) ShowUsers(...) (planNode, error) {
stmt, err := parser.ParseOneTraditional("SELECT ... ")
if err != nil { return nil, err }
return p.newPlan(stmt, true)
} In cases where they are no variable parts in the SQL syntax you can even optimize further: var stmtShow Statement
func init() {
stmtShow, _ = parser.ParseOne(...)
}
func (p *planner) ShowUsers(...) (planNode, error) {
return p.newPlan(stmtShow, true)
} |
@knz it works. Thank you very much. |
@yznming w.r.t your question about |
@nvanbenschoten currently, I think we need to extend the information_schema as follow:
|
|
Regarding point 1 I am not in favor of adding hidden columns (Also apparently PG doesn't show them there either) |
@nvanbenschoten Is that means what we need to do next step:
|
@nvanbenschoten BTW, I'm going to order the result of
|
@yznming Those sorting orders sound fine to me. You brought up |
@nvanbenschoten Of course. I think these |
Great, there are a few previous changes related to that issue which demonstrate what adding a new |
@nvanbenschoten, I'm seeing some difference in the way Example:
|
@nvanbenschoten
|
@jseldess Thanks for pointing that out. I don't think the discrepancy was intentional, but luckily the work @yznming is doing should unify this behavior. @yznming What behavior would querying |
@nvanbenschoten if the table is drop , it would not show up:
|
@yznming That seems fine for now. |
After this refactor, adding support for |
@sploiselle: that might be something @yznming would be interested in working on after this change, and will certainly take advantage of the major improvements he's made to the SHOW infrastructure, but we shouldn't try to add new functionality in during such an involved refactor. |
Closed by #10196. |
There is a good amount of duplication between metadata returned from
SHOW
statements and metadata in theinformation_schema
. It would be nice to mapSHOW
statements directly onto queries from theinformation_schema
. This would probably require adding a few moreinformation_schema
tables.The text was updated successfully, but these errors were encountered: