Skip to content
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: Unexpected Error in SHOW COLUMNS #85394

Open
bajinsheng opened this issue Aug 1, 2022 · 5 comments
Open

sql: Unexpected Error in SHOW COLUMNS #85394

bajinsheng opened this issue Aug 1, 2022 · 5 comments
Labels
branch-master Failures and bugs on the master branch. C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. O-community Originated from the community T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions)

Comments

@bajinsheng
Copy link

bajinsheng commented Aug 1, 2022

Describe the problem

Unexpected error.

To Reproduce

CREATE TABLE t0 (c0 STRING[] DEFAULT (ARRAY[(('L+') COLLATE cmn)]));
SHOW COLUMNS FROM t0; -- ERROR: incompatible type annotation for ARRAY['L+':::STRING COLLATE cmn] as string[], found type: collatedstring{cmn}[] SQLSTATE: 42804

Expected behavior
No error.

Environment:

  • CockroachDB version [6374bd8]
  • Server OS: [Ubuntu 20.04]
  • Client app [cockroach sql]

Additional context

Jira issue: CRDB-18225

@bajinsheng bajinsheng added the C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. label Aug 1, 2022
@blathers-crl
Copy link

blathers-crl bot commented Aug 1, 2022

Hello, I am Blathers. I am here to help you get the issue triaged.

Hoot - a bug! Though bugs are the bane of my existence, rest assured the wretched thing will get the best of care here.

I was unable to automatically find someone to ping.

If we have not gotten back to your issue within a few business days, you can try the following:

  • Join our community slack channel and ask on #cockroachdb.
  • Try find someone from here if you know they worked closely on the area and CC them.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan.

@blathers-crl blathers-crl bot added O-community Originated from the community X-blathers-untriaged blathers was unable to find an owner labels Aug 1, 2022
@blathers-crl blathers-crl bot added the T-sql-queries SQL Queries Team label Aug 1, 2022
@yuzefovich yuzefovich removed X-blathers-untriaged blathers was unable to find an owner T-sql-queries SQL Queries Team labels Aug 1, 2022
@yuzefovich
Copy link
Member

This errors on 22.1.5:

[email protected]:26257/defaultdb> CREATE TABLE t0 (c0 STRING[] DEFAULT (ARRAY[(('L+') COLLATE cmn)]));                                            
ERROR: expected DEFAULT expression to have type string[], but '(ARRAY['L+' COLLATE cmn])' has type collatedstring{cmn}[]

so adding a release blocker label.

@yuzefovich yuzefovich added the release-blocker Indicates a release-blocker. Use with branch-release-2x.x label to denote which branch is blocked. label Aug 2, 2022
@blathers-crl
Copy link

blathers-crl bot commented Aug 2, 2022

Hi @yuzefovich, please add branch-* labels to identify which branch(es) this release-blocker affects.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan.

@yuzefovich yuzefovich added the branch-master Failures and bugs on the master branch. label Aug 2, 2022
@yuzefovich
Copy link
Member

I did some archeology, and here is what I got:

We have the DEFAULT value that is an array of collated strings whereas the required type (the type of the column in the table) is an array of strings, so two types are not Equivalent. We did find an assignment cast for them though because the array contents have the same Oid.

I'm not quite sure what to do here, but maybe we need another check in typeCheckAndRequire that is different from types.T.Equvalent check and is more assignment-cast-like permissive. cc @mgartner in case you have some ideas

This seems like a SQL Experience issue, so I'm putting it there to triage for further, but my guess is that it is an edge case, so it'll go on the backlog.

@yuzefovich yuzefovich removed the release-blocker Indicates a release-blocker. Use with branch-release-2x.x label to denote which branch is blocked. label Aug 3, 2022
@yuzefovich yuzefovich removed their assignment Aug 3, 2022
@yuzefovich yuzefovich changed the title Unexpected Error in SHOW COLUMNS sql: Unexpected Error in SHOW COLUMNS Aug 4, 2022
@rafiss rafiss added the T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions) label Oct 3, 2022
Copy link

We have marked this issue as stale because it has been inactive for
18 months. If this issue is still relevant, removing the stale label
or adding a comment will keep it active. Otherwise, we'll close it in
10 days to keep the issue queue tidy. Thank you for your contribution
to CockroachDB!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
branch-master Failures and bugs on the master branch. C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. O-community Originated from the community T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions)
Projects
No open projects
Status: Triage
Development

No branches or pull requests

3 participants