-
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
v2.0-beta.20180319: Regression in star queries #24169
Comments
Hi @charsleysa, For better Postgres compatibility, we've changed CockroachDB's name resolution to understand the concept of database schemas. This means that there's now another level in the name hierarchy, between database and table: the schema. The default schema in CockroachDB (and the only one with user data, since we don't yet support custom schemas) is called To work around this, you may insert
We didn't quite realize that anyone was using fully qualified names in render expressions, otherwise we would have caught this. Why do you need to qualify the table by the database name, though? If you're connected to the database cc @knz |
Hi @jordanlewis, Thanks for getting back quickly. I am aware some of those changes were made but I was using the I think I may have missed some information when initially creating the issue, the following query works in v1.1.6 AND the v2.0-beta: select
"myblueprint"."study_industry"."id",
"myblueprint"."study_industry"."title"
from "myblueprint"."study_industry" |
Oh, I see. That seems like a bug. Here's a simple reproduction:
|
I'll look into it when I am back. |
(technical information ahead - not relevant to understand the issue, but necessary to fix): The proximate cause is that FindColumnInSource / FindSourceProvidingColumn assume that the given prefix (if any) must match one of the names provided by the source(s). Meanwhile, the source name undergoes qualification before its name is made available to column name resolution, so from the perspective of ColumnResolver there are only fully qualified sources with "public" in them. To address this properly requires adding to FindColumnInSource / FindSourceProvidingColumn the same crdb 1.x compatibility fallback that is also present in table name resolution. However, achieving this change probably requires extra care (need to investigate what are the subtleties associated with dbs called "public") and what happens when both "db.public.blah" and "public.public.blah" are in scope for a given column resolution. cc @rytaft - Becca, maybe this doesn't change anything for you, but you'll want to watch the story as it unfolds. The ambiguity problem will need attention + docs when we extend the fix to this issue to work with correlated naming resolution. |
24811: sql: use a reusable name resolution algo for star expansions r=knz a=knz Fixes #24169. A previous patch has added a reusable name resolution mechanism which encapsulates all the special cases supported CockroachDB into a single code path. This covers both the resolution of object names and column names. Prior to this patch however, the expansion of qualified stars was using a separate code path. This proved to be incorrect/insufficient however, because one of the special cases of name resolution should apply to star expansion too and the separate code path did not contain the special case. To solve this problem, this patch abstracts the resolution of qualified stars in a common algorithm alongside the others (in `sem/name_resolution.go`) and ensures it is used where applicable. Release note (bug fix): CockroachDB now again allows to use a simply qualified table name in qualified stars (e.g., `SELECT mydb.kv.* FROM kv`), for compatibility with CockroachDB v1.x. Co-authored-by: Raphael 'kena' Poss <knz@cockroachlabs.com>
BUG REPORT
Executed the following query
What did you expect to see?
All rows with all columns from the table.
What did you see instead?
The following error
[42703] ERROR: no data source named "myblueprint.study_industry"
This worked fine in v1.1.6 but is now broken in v2.0-beta.20180319
The text was updated successfully, but these errors were encountered: