-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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: Initial support for creating and dropping views #9212
Conversation
I'd love to see a testdata/view with some logic tests too: Also, I know this is a first-step, but I'm a little worried about adding writing of table descriptors to where they can be found and retrieved by other code paths that don't know about / handle them yet. Off the top of my head, does Does it make sense to add a Reviewed 11 of 13 files at r1, 8 of 9 files at r2, 1 of 1 files at r3. sql/create.go, line 312 [r1] (raw file):
fwiw, afaik, this will never be true right now, since neither sql/create.go, line 982 [r1] (raw file):
Yeah, when saving an expr to disk (e.g. in CHECK) we use Format (vs the raw original verbatim) -- one benefit of that is that we can then always parse them as Traditional syntax, without having to store/plumb the session syntax that created them. sql/create.go, line 974 [r3] (raw file):
Does this not need to use sql/sqlbase/structured.go, line 874 [r3] (raw file):
nit: could reuse the Comments from Reviewable |
Yeah, we should add a check to the common accessors, since this could definitely cause some trickiness. I'll work on that next - it might take a little longer than expected since I'll have to figure out what/where all the accessors are. I got parsing and logic tests added. Thanks for the review! Review status: 6 of 17 files reviewed at latest revision, 4 unresolved discussions, some commit checks failed. sql/create.go, line 312 [r1] (raw file):
|
597cd86
to
9d76391
Compare
PTAL @dt. I've updated the code that gets table descriptors to not return views unless asked and prevented anyone from taking a lease on a view descriptor for the time being, although IIUC that part will have to change as I add support for querying from and/or altering views. Review status: 4 of 26 files reviewed at latest revision, 4 unresolved discussions, some commit checks pending. Comments from Reviewable |
00d3548
to
fde5bdf
Compare
Reviewed 2 of 13 files at r7, 8 of 9 files at r8, 1 of 1 files at r9, 2 of 3 files at r11, 1 of 2 files at r12, 8 of 8 files at r13. sql/create.go, line 312 at r1 (raw file):
|
Thanks for the review! I've rebased on top of your #9327 which made a couple similar cleanups and switched to your new pattern of calling makeTableDesc only after checking for already exists errors and generating an ID. Review status: 5 of 25 files reviewed at latest revision, 1 unresolved discussion, some commit checks pending. Comments from Reviewable |
There's still quite a bit of work needed to finish off #2971, but this adds the basic framework for creating and dropping views.
The main TODOs outstanding are:
I'm sending this out now since it can somewhat stand on its own to avoid sending out a giant PR later, but let me know if you'd prefer to just see it all at once later.
cc @paperstreet @dt @nvanbenschoten - I'm just guessing at who to assign. Feel free to reassign, hopefully no hard feelings :)
This change is