-
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, *: make CockroachDB understand schema names #22371
Conversation
Note especially the section "Details and suggestions to the reviewers" in the PR description. cc: @vivekmenezes: items 7 and 9. |
cee36a0
to
aaaba1e
Compare
sql/opt changes (item 2) LGTM Review status: 0 of 90 files reviewed at latest revision, 1 unresolved discussion, some commit checks broke. pkg/sql/opt/scope.go, line 53 at r1 (raw file):
[nit] incorrect name. Also "is part of" is better than "implements" (which really only makes sense if this is the only method in the interface). Comments from Reviewable |
Review status: 0 of 90 files reviewed at latest revision, 5 unresolved discussions, some commit checks broke. pkg/sql/sem/tree/name_part.go, line 159 at r1 (raw file):
[nit, not this change] actual length pkg/sql/sem/tree/name_resolution.go, line 32 at r1 (raw file):
[nit] extra lines pkg/sql/sem/tree/name_resolution.go, line 58 at r1 (raw file):
This construction code is repeated a bunch of times, maybe it should be a function. pkg/sql/sem/tree/name_resolution.go, line 115 at r1 (raw file):
This empty checking code appears in many places, it should probably be a separate function. Comments from Reviewable |
Is there any way to break this up? It will be very difficult for your reviewers to successfully determine whether a |
That's why I proposed a split of reviewing responsibilities so that each part is bite sized.
…--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
|
Yes! I should have started by saying thanks for the excellent executive summary and directions for review. I do think that will help. However, I worry that it'll be hard for any single reviewer to get a big picture of what's happening here. The whole is more than the sum of the parts and all that. |
A silly question - the new functionality (as opposed to refactoring) in this PR is for more than supporting one schema literally called "public", right? Review status: 0 of 90 files reviewed at latest revision, 5 unresolved discussions, some commit checks broke. Comments from Reviewable |
Splitting the review responsibility seems like a good way for something to slip through the cracks. I imagine there was a way to break this into smaller chunks, but what is done is done. My main anxiety is that name resolution can affect performance. @jordanlewis can you either show Raphael how to run Review status: 0 of 90 files reviewed at latest revision, 32 unresolved discussions, some commit checks broke. pkg/ccl/sqlccl/targets_test.go, line 70 at r1 (raw file):
Does pkg/config/zone.go, line 135 at r1 (raw file):
pkg/sql/create_index.go, line 42 at r1 (raw file):
Note to self: what is this? Why is it not needed before pkg/sql/create_stats.go, line 38 at r1 (raw file):
No call to pkg/sql/data_source.go, line 384 at r1 (raw file):
Did you intend to keep these? pkg/sql/data_source.go, line 587 at r1 (raw file):
Do you need a pkg/sql/data_source.go, line 806 at r1 (raw file):
Reminder to address this. And below too. pkg/sql/database.go, line 107 at r1 (raw file):
nit: The previous name wasn't accurate, but this new name isn't accurate either. How about pkg/sql/phy_schema_accessors.go, line 1 at r1 (raw file):
nit: Do we use the abbreviation pkg/sql/phy_schema_accessors.go, line 169 at r1 (raw file):
It is unfortunate that we're using pkg/sql/planner.go, line 216 at r1 (raw file):
Reminder to address this. pkg/sql/resolver.go, line 110 at r1 (raw file):
Can you expand on when this needs to be called? You're often calling it before calling pkg/sql/resolver.go, line 127 at r1 (raw file):
nit: This can be pkg/sql/resolver.go, line 162 at r1 (raw file):
nit: This would be more readable as a line per field. pkg/sql/schema_accessors.go, line 51 at r1 (raw file):
I'm not sure I buy the convenience argument. Type aliases were mainly added to ease refactoring when you can't do so "atomically" (i.e. the refactor is spread across repos). On the other hand, I don't particularly mind this. nit: These comments exceed 100 columns. pkg/sql/sequence.go, line 263 at r1 (raw file):
Reminder to address this (or convert to pkg/sql/set_zone_config.go, line 76 at r1 (raw file):
pkg/sql/zone_test.go, line 68 at r1 (raw file):
Shouldn't there be test cases for both pkg/sql/pgwire/conn_test.go, line 176 at r1 (raw file):
Did you intend to leave this in? pkg/sql/sem/tree/name_resolution.go, line 103 at r1 (raw file):
Heh, pkg/sql/sem/tree/name_resolution.go, line 252 at r1 (raw file):
Should this be protected by pkg/sql/sem/tree/name_resolution.go, line 295 at r1 (raw file):
pkg/sql/sem/tree/name_resolution_test.go, line 589 at r1 (raw file):
I believe you can define this inside pkg/sql/sem/tree/name_resolution_test.go, line 591 at r1 (raw file):
You can define this inside pkg/sql/sem/tree/name_resolution_test.go, line 593 at r1 (raw file):
Nice tests. pkg/sql/sem/tree/name_resolution_test.go, line 604 at r1 (raw file):
pkg/sql/sem/tree/name_resolution_test.go, line 612 at r1 (raw file):
You could get rid of the Comments from Reviewable |
Here's my main area of concern: historically we haven't been principled about when we can use "cached" descriptors and when we can't. Our understanding has improved significantly with the last iteration on the schema change RFC, but I'm not sure to what extent the code has caught up. I believe we can always use cached descriptors, as long as the cache is aware of the timestamps involved. I always thought that the Other than that, for point #10 - the changes in Review status: 0 of 90 files reviewed at latest revision, 36 unresolved discussions, some commit checks broke. pkg/sql/schema_accessors.go, line 25 at r1 (raw file):
nit: "this file proposes" is a weird phrasing for a code file. "This file contains interfaces for accessing descriptors (physical schema)". It'd also be nice if a hint to what is the opposite of physical - what's the "logical" schema? pkg/sql/schema_accessors.go, line 28 at r1 (raw file):
Unless there's good reason for so many interfaces and without knowing anything about anything, they look too many for my taste. If possible to have less... pkg/sql/session.go, line 675 at r1 (raw file):
can this guy go away now with the new pkg/sql/session.go, line 681 at r1 (raw file):
I'd make this exported like everything else unless you have reason not to Comments from Reviewable |
items 2 and 6 LGTM Reviewed 7 of 90 files at r1. pkg/sql/opt/build/scope.go, line 67 at r1 (raw file):
[nit] fix name. pkg/sql/opt/build/scope.go, line 76 at r1 (raw file):
Do you have a pointer we can look at for where this is done correctly (to fix this issue)? pkg/sql/opt/build/scope.go, line 96 at r1 (raw file):
Ditto - do you have a pointer we can look at for where this is done correctly (to fix these issues)? pkg/sql/sem/tree/name_resolution.go, line 124 at r1 (raw file):
There are a lot of bare numbers here. Maybe make an enum for the different name parts? Comments from Reviewable |
Item 5, won't this fail admin_test.go\TestAdminAPIDatabaseVirtual() ? Reviewed 1 of 90 files at r1. Comments from Reviewable |
Review status: 8 of 90 files reviewed at latest revision, 40 unresolved discussions, some commit checks broke. pkg/sql/opt/build/scope.go, line 76 at r1 (raw file): Previously, rytaft wrote…
As I am currently rewriting this, I'll make an attempt at documenting it better. Comments from Reviewable |
Item 10 LGTM Review status: 8 of 90 files reviewed at latest revision, 40 unresolved discussions, some commit checks broke. Comments from Reviewable |
Item 7 LGTM Review status: 8 of 90 files reviewed at latest revision, 40 unresolved discussions, some commit checks broke. Comments from Reviewable |
aaaba1e
to
603eded
Compare
Bram yes indeed it broke that test. I had to remove it. Peter, Rebecca, Vivek thank you! Andrei regarding desc caching it would be great if we could confirm that indeed we can always use the cache, it would simplify the code very greatly. I am not fond of the hoops I had to jump through to keep that conditional. Let's talk soon. I am still working on the PR, as CI revealed my last amend broke several things and Nathan reminded me I still had to update the virtual table generators. Will ping when I have news. Review status: 0 of 88 files reviewed at latest revision, 40 unresolved discussions, all commit checks successful. pkg/ccl/sqlccl/targets_test.go, line 70 at r1 (raw file): Previously, petermattis (Peter Mattis) wrote…
It still works, I was just a bit too trigger-happy on the global search-and-replace. Added the issing tests. pkg/config/zone.go, line 135 at r1 (raw file): Previously, petermattis (Peter Mattis) wrote…
Done. pkg/sql/create_index.go, line 42 at r1 (raw file): Previously, petermattis (Peter Mattis) wrote…
It exposes non-public descriptors to the resolution algorithm. This is because CREATE INDEX can target newly created tables. pkg/sql/create_stats.go, line 38 at r1 (raw file): Previously, petermattis (Peter Mattis) wrote…
CREATE STATS cannot target newly created tables inside the same txn (as indicated by the pkg/sql/data_source.go, line 384 at r1 (raw file): Previously, petermattis (Peter Mattis) wrote…
woops, oversight. pkg/sql/data_source.go, line 587 at r1 (raw file): Previously, petermattis (Peter Mattis) wrote…
no, in here we're conditional on what the caller has set (idem as the previous code) pkg/sql/data_source.go, line 806 at r1 (raw file): Previously, petermattis (Peter Mattis) wrote…
yes thanks for noticing! pkg/sql/database.go, line 107 at r1 (raw file): Previously, petermattis (Peter Mattis) wrote…
I'll welcome any suggestion. No skin in this game. pkg/sql/planner.go, line 216 at r1 (raw file): Previously, petermattis (Peter Mattis) wrote…
yep thanks pkg/sql/resolver.go, line 110 at r1 (raw file): Previously, petermattis (Peter Mattis) wrote…
Done. pkg/sql/resolver.go, line 127 at r1 (raw file): Previously, petermattis (Peter Mattis) wrote…
oh cool TIL. Thanks! pkg/sql/resolver.go, line 162 at r1 (raw file): Previously, petermattis (Peter Mattis) wrote…
Done. pkg/sql/schema_accessors.go, line 25 at r1 (raw file): Previously, andreimatei (Andrei Matei) wrote…
Done. pkg/sql/schema_accessors.go, line 28 at r1 (raw file): Previously, andreimatei (Andrei Matei) wrote…
I'd like to discuss this with you and jordan. Fewer interfaces make it harder to layer the functionality cleanly. pkg/sql/schema_accessors.go, line 51 at r1 (raw file): Previously, petermattis (Peter Mattis) wrote…
Fixed the width. The utility came in by enabling me to write less code, and making the remaining declarations much more compact. It accelerated my work; for me this is a net win. pkg/sql/sequence.go, line 263 at r1 (raw file): Previously, petermattis (Peter Mattis) wrote…
no I need to fix this really before this can merge. looking into it. pkg/sql/session.go, line 675 at r1 (raw file): Previously, andreimatei (Andrei Matei) wrote…
huh hmm maybe I haven't thought about it. If there are cleanup opportunities I'll look into it at the end. pkg/sql/session.go, line 681 at r1 (raw file): Previously, andreimatei (Andrei Matei) wrote…
Yes I have a reason not to, that's to ensure the user clearly decides to either call pkg/sql/set_zone_config.go, line 76 at r1 (raw file): Previously, petermattis (Peter Mattis) wrote…
Done. pkg/sql/opt/scope.go, line 53 at r1 (raw file): Previously, RaduBerinde wrote…
Interesting, TIL. Modified. pkg/sql/opt/build/scope.go, line 67 at r1 (raw file): Previously, rytaft wrote…
Doneprevious pkg/sql/sem/tree/name_part.go, line 159 at r1 (raw file): Previously, RaduBerinde wrote…
Done. pkg/sql/sem/tree/name_resolution.go, line 32 at r1 (raw file): Previously, RaduBerinde wrote…
Done. pkg/sql/sem/tree/name_resolution.go, line 58 at r1 (raw file): Previously, RaduBerinde wrote…
Done. pkg/sql/sem/tree/name_resolution.go, line 103 at r1 (raw file): Previously, petermattis (Peter Mattis) wrote…
Simplified. pkg/sql/sem/tree/name_resolution.go, line 115 at r1 (raw file): Previously, RaduBerinde wrote…
The 3 occurrences are oh so slightly different from each other. One doesn't use the same start value, and the 2 others don't use the same error message. Suggestions welcome. pkg/sql/sem/tree/name_resolution.go, line 124 at r1 (raw file): Previously, rytaft wrote…
How do you suggest to call them? pkg/sql/sem/tree/name_resolution.go, line 252 at r1 (raw file): Previously, petermattis (Peter Mattis) wrote…
I had that initially, but the tests showed it was wrong :) Added a comment to clarify. pkg/sql/sem/tree/name_resolution.go, line 295 at r1 (raw file): Previously, petermattis (Peter Mattis) wrote…
Done. pkg/sql/sem/tree/name_resolution_test.go, line 589 at r1 (raw file): Previously, petermattis (Peter Mattis) wrote…
TIL, done pkg/sql/sem/tree/name_resolution_test.go, line 591 at r1 (raw file): Previously, petermattis (Peter Mattis) wrote…
Done pkg/sql/sem/tree/name_resolution_test.go, line 604 at r1 (raw file): Previously, petermattis (Peter Mattis) wrote…
Done. pkg/sql/sem/tree/name_resolution_test.go, line 612 at r1 (raw file): Previously, petermattis (Peter Mattis) wrote…
Yay! done. pkg/sql/zone_test.go, line 68 at r1 (raw file): Previously, petermattis (Peter Mattis) wrote…
no my changes here were mistaken. the CLI specifier syntax (which will soon disappear, btw) is not the same as SQL syntax. pkg/sql/pgwire/conn_test.go, line 176 at r1 (raw file): Previously, petermattis (Peter Mattis) wrote…
Nope! pkg/sql/phy_schema_accessors.go, line 1 at r1 (raw file): Previously, petermattis (Peter Mattis) wrote…
Ok done pkg/sql/phy_schema_accessors.go, line 169 at r1 (raw file): Previously, petermattis (Peter Mattis) wrote…
Agreed Comments from Reviewable |
603eded
to
3e201f7
Compare
please do not make the change to have AS OF SYSTEM TIME queries use the descripotor cache in this change. I tried doing that this week and ran into some trouble. The scope of this change is large enough that we shouldn't do that here. Thanks! |
The information_schema introspection queries were incorrect after the change made in cockroachdb/cockroach#22371.
1f2c20d
to
a91748c
Compare
Merged the 6 schema accessor interfaces into just 2 as requested by Andrei. Review status: 98 of 233 files reviewed at latest revision, 34 unresolved discussions, some commit checks pending. pkg/sql/logictest/testdata/logic_test/information_schema, line 284 at r7 (raw file): Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
Yes we'll see the pkg/sql/logictest/testdata/logic_test/information_schema, line 293 at r7 (raw file): Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
Done. pkg/sql/logictest/testdata/logic_test/information_schema, line 1203 at r7 (raw file): Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
Done. pkg/sql/opt/optbuilder/builder.go, line 770 at r6 (raw file): Previously, justinj (Justin Jaffray) wrote…
Oh interesting. TIL. pkg/sql/sem/tree/name_resolution.go, line 211 at r5 (raw file): Previously, RaduBerinde wrote…
Ok will do before this merges. Comments from Reviewable |
The information_schema introspection queries were incorrect after the change made in cockroachdb/cockroach#22371.
a91748c
to
b470b02
Compare
The information_schema introspection queries were incorrect after the change made in cockroachdb/cockroach#22371.
fe8c690
to
310277e
Compare
528adaf
to
b0d2d32
Compare
Implemented the interface abstractions suggested by Radu. Review status: 92 of 308 files reviewed at latest revision, 34 unresolved discussions, some commit checks pending. Comments from Reviewable |
da47831
to
fa6797e
Compare
"Why": Prior to this patch, CockroachDB only recognized names of the form "db.tbl", like MySQL, whereas PostgreSQL compatibility mandates that "db.public.tbl" be also valid. This needed a change. **What:** The visible tip of this iceberg patch is as follows: - new name resolution functions which are more correct and more easy to use than the previous code! Use `Normalize()` on a `TableName`, then `ResolveExistingObject()` or `ResolveTargetObject()`. - this in turn relies on generic, well-abstracted name resolution algorithms in `sem/tree/name_resolution.go`, the definition of which closely follows the specs in the accompanying RFC. This handles the pg syntax for catalog and schema names, together with compatibility rules with CockroachDB v1.x. - a new schema accessor interface that truly encapsulates schema access! Check out the gorgeous documentation in `sql/schema_accessors.go`. In particular: - `planner` now implements a new interface `SchemaResolver`. Use it. - if you are not happy with `SchemaResolver` directly, use `SchemaAccessor` or its various consistuent interfaces. Depending on whether virtual schemas are to be considered, consider alternatively `planner.LogicalSchemaAccessor()` and `planner.PhysicalSchemaAccessor()`. One may be surprised to see this schema accessor work happen in the same patch. This was, unfortunately, a requirement to successfully plug catalog and schema name resolution in all the right places. Also, it incidentally answers a long-standing demand for a better interface to access descriptors. **How:** The itinerary to achieve this brought me through the following steps: - the various name resolution algorithms are concentrated in a new file `sql/sem/tree/name_resolution.go`. They use abstract interfaces to interface with the "name provider": database, table, column things coming from the database. - in the process of writing the name resolution algorithms, I found that our previous understanding of name resolution was problematic: - the previous code assumed it was always possible to "qualify a name using the current database" by just looking at the name itself and the current database, without any additional information. In contrast, the correct qualification algorithms requires both the current database, the search path, and descriptor lookups. This is why this patch fuses all occurrences of separate "qualification" and "resolution" phases together. Before: `tn = tn.QualifyWithDatabase(tcurDb); desc = MustGetDesc(tn)` After: `desc = ResolveExistingObject(p, tn)` - the resolution code was pushing a `VirtualTabler` very deep in the lookup routines, with the mistaken understanding that VirtualTabler is able to respond to requests for database names. In contrast, VirtualTabler really has nothing to do with database names, and the corresponding code had to get rid of it. This was the first motivation for implementing new schema accessor interfaces. - the path to decide whether to use cached or non-cached descriptors was very hard to read; in many instances the code was using uncached descriptors where cached descriptors would be needed instead. The various APIs were a mess, and information needed to decide whether a lookup was possible or not was not available at the right level(s) of abstraction. This was the second motivation for implementing new schema accessor interfaces. - Once this all was said done, the various consumers of name resolution had to implement the interfaces. They are: - resolution of zone specifiers; - resolution of target names for CCL statements; - resolution of names (both existing and targets) in the `sql` package; - some testing code in `sql/opt` and `sql/opt/build`. - the virtual schemas and tables. Release note (sql change): CockroachDB now recognizes the syntax `db.public.tbl` in addition to `db.tbl`, for better compatibility with PostgreSQL. The handling of the session variable `search_path`, as well as that of the built-in functions `current_schemas()` and `current_schema()`, is now closer to that of PostgreSQL. Release note (sql change): SHOW TABLES FROM can now inspect the tables of a specific shema, for example `SHOW TABLES FROM db.public` or `SHOW TABLES FROM db.pg_catalog`. Release note (sql change): SHOW GRANTS now also shows the schema of the databases and tables.
fa6797e
to
15b73e3
Compare
Replaced by #22753. |
Great job! I'm cuurious as to why you needed another PR to merge this?
…On Thu, Feb 15, 2018 at 10:45 PM kena ***@***.***> wrote:
Closed #22371 <#22371>.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#22371 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ALOpBDzPOiOBv-egU7eoWWg62gljW_UXks5tVPnhgaJpZM4R48p8>
.
|
I had based this PR off another branch than master, where I had accumulated some unrelated troubleshooting changes that were aiding development. Unfortunately github does not allow me to change the base branch before merging. I could have merged this PR, and then created another PR to merge the base branch into master; but in the end there would still be two PRs. |
The name resolution overhaul (cockroachdb#22371) caused TestDockerCSharp to start failing. Specifically, I suspect that Npgsql performs some query on a table in the pg_catalog schema, which now requires the session database to exist. There seems to be no way to prevent Npgsql from performing this query, so simply instruct it to connect to the system database, which is guaranteed to exist. Also delete a test that checked the oid of the pg_catalog namespace entry. That's changed since the test has been skipped, and seems like a moving target. I'm not sure why we cared about the oid's value in the first palce. Fix cockroachdb#22769. Release note: None
Fixes #22700.
"Why":
Prior to this patch, CockroachDB only recognized names of the form
"db.tbl", like MySQL, whereas PostgreSQL compatibility mandates that
"db.public.tbl" be also valid. This needed a change.
"What"
The visible tip of this iceberg patch is as follows:
new name resolution functions which are more correct and more easy
to use than the previous code!
Use
Normalize()
on aTableName
, thenResolveExistingObject()
or
ResolveTargetObject()
.this in turn relies on generic, well-abstracted name resolution
algorithms in
sem/tree/name_resolution.go
, the definitionof which closely follows the specs in the accompanying RFC (rfcs: proposal to make schemas more pg-compatible #21456).
This handles the pg syntax for catalog and schema names, together
with compatibility rules with CockroachDB v1.x.
a new schema accessor interface that truly encapsulates schema access!
Check out the gorgeous documentation in
sql/schema_accessors.go
.In particular:
planner
now implements a new interfaceSchemaResolver
. Use it.if you are not happy with
SchemaResolver
directly, useSchemaAccessor
or its various consistuent interfaces.Depending on whether virtual schemas are to be considered, consider
alternatively
planner.LogicalSchemaAccessor()
andplanner.PhysicalSchemaAccessor()
.One may be surprised to see this schema accessor work happen in the
same patch. This was, unfortunately, a requirement to successfully
plug catalog and schema name resolution in all the right places.
Also, it incidentally answers a long-standing demand for a better
interface to access descriptors.
"How"
The itinerary to achieve this brought me through the following steps:
the various name resolution algorithms are concentrated in a new
file
sql/sem/tree/name_resolution.go
. They use abstractinterfaces to interface with the "name provider": database, table,
column things coming from the database.
in the process of writing the name resolution algorithms, I found
that our previous understanding of name resolution was problematic:
the previous code assumed it was always possible to "qualify a
name using the current database" by just looking at the name
itself and the current database, without any additional
information.
In contrast, the correct qualification algorithms requires both
the current database, the search path, and descriptor
lookups.
This is why this patch fuses all occurrences of separate
"qualification" and "resolution" phases together.
Before:
tn = tn.QualifyWithDatabase(tcurDb); desc = MustGetDesc(tn)
After:
desc = ResolveExistingObject(p, tn)
the resolution code was pushing a
VirtualTabler
very deep in thelookup routines, with the mistaken understanding that
VirtualTabler is able to respond to requests for database names.
In contrast, VirtualTabler really has nothing to do with database
names, and the corresponding code had to get rid of it.
This was the first motivation for implementing new schema accessor
interfaces.
the path to decide whether to use cached or non-cached descriptors
was very hard to read; in many instances the code was using
uncached descriptors where cached descriptors would be needed
instead. The various APIs were a mess, and information needed to
decide whether a lookup was possible or not was not available at
the right level(s) of abstraction.
This was the second motivation for implementing new schema accessor
interfaces.
Once this all was said done, the various consumers of name
resolution had to implement the interfaces. They are:
sql
package;sql/opt
andsql/opt/build
.Details and suggestions to the reviewers
The following items are fairly self-contained and can be reviewed in
parallel, and probably should be reviewed first:
the changes in
ccl/sqlccl
. This achieves the following two things:QualifyWithDatabase
any more (because that was removed);instead they use the new name resolution interface with a shim
that just checks the schema name is valid.
the changes in
sql/opt
andsql/opt/build
. This merelyinterfaces with the name resolution algorithm for column items. I
noticed that the underlying data structures there only know about
unqualified table names, so I did not attempt to plumb
catalog/schema name resolution logic in there. No functionality is
lost.
the changes in
pkg/config
for zone specifiers. These arestraightforward and merely deal with the correspondance between the
schema part in the CLI zone specifier syntax and the catalog part of
the internal
ZoneSpecifier
struct.the new file
resolver.go
, which contains the entry-pointfunctions for name resolution using a
SchemaResolver
.the changes to
server/admin.go
. These simply get rid of thevirtual database checks (we have virtual schemas, not databases,
now.)
the name resolution algorithms in
sem/tree/name_resolution.go
and the corresponding tests in
sem/tree/name_resolution_test.go
.This is where it all started and should be compared to the
specifications in the accompanying RFC (rfcs: proposal to make schemas more pg-compatible #21456).
the interface definitions in
schema_accessors.go
and theirimplementations in
phy_schema_accessors.go
andlogical_schema_accessors.go
.Once the last two items in the list above have been reviewed,
it becomes possible to proceed as follows:
check that the various planNode constructors access the new APIs
consistently, with no surprises.
check that no harm was done in
table.go
(table cache) anddatabase.go
(database cache).check that the construction of the main accessors in
session.go
make sense.Suggested review attributions:
Release note (sql change): CockroachDB now recognizes the syntax
db.public.tbl
in addition todb.tbl
, for better compatibility withPostgreSQL.