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: Remove type annotations from column_default in information_schema.columns #94153

Merged
merged 1 commit into from
Jan 26, 2023

Conversation

e-mbrown
Copy link
Contributor

@e-mbrown e-mbrown commented Dec 22, 2022

Informs: #87774

The type annotation on column_default caused confusion in postgres compatible apps. This change formats the column_default without the type annotation. It does not address the incorrect type annotation.

Release note (bug fix): The content of column_default in information_schema.columns no longer have type annotations.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@e-mbrown e-mbrown requested review from rafiss and a team January 11, 2023 09:40
@e-mbrown e-mbrown requested a review from a team January 11, 2023 10:12
@e-mbrown e-mbrown requested a review from a team as a code owner January 11, 2023 10:12
@dhartunian dhartunian removed the request for review from a team January 11, 2023 17:46
Copy link
Collaborator

@ZhouXing19 ZhouXing19 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @e-mbrown and @rafiss)


pkg/sql/logictest/testdata/logic_test/information_schema line 2073 at r1 (raw file):


query TT colnames
select data_type, column_default  from information_schema.columns where table_name = 't2' and column_name = 'a';

nit: there's an extra space in front of from.


pkg/sql/logictest/testdata/logic_test/information_schema line 4915 at r1 (raw file):

other_db       public        t2          c            1
other_db       public        t2          d            2
test           public        t2          rowid        2

Hmm, this may have revealed another difference from PG. Seems that with postgres this rowid column won't show up.

postgres=# CREATE TABLE t1(a INT PRIMARY KEY, b BOOLEAN);
CREATE TABLE

postgres=# CREATE TABLE t2(a smallint DEFAULT 0);
CREATE TABLE

postgres=# SELECT table_catalog, table_schema, table_name, column_name, ordinal_position
FROM information_schema.columns where table_name = 't1' OR table_name = 't2';
 table_catalog | table_schema | table_name | column_name | ordinal_position
---------------+--------------+------------+-------------+------------------
 postgres      | public       | t2         | a           |                1
 postgres      | public       | t1         | a           |                1
 postgres      | public       | t1         | b           |                2

I can open an issue for this.

…hema

.columns`

The type annotation on `column_default` caused confusion
in postgres compatible apps. This change formats the
`column_default` without the type annotation. It does not
address the incorrect type annotation.

Release note (bug fix): The content of `column_default`
in `information_schema.columns` no longer have type
annotations.
Copy link
Contributor Author

@e-mbrown e-mbrown left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @rafiss and @ZhouXing19)


pkg/sql/logictest/testdata/logic_test/information_schema line 4915 at r1 (raw file):

Previously, ZhouXing19 (Jane Xing) wrote…

Hmm, this may have revealed another difference from PG. Seems that with postgres this rowid column won't show up.

postgres=# CREATE TABLE t1(a INT PRIMARY KEY, b BOOLEAN);
CREATE TABLE

postgres=# CREATE TABLE t2(a smallint DEFAULT 0);
CREATE TABLE

postgres=# SELECT table_catalog, table_schema, table_name, column_name, ordinal_position
FROM information_schema.columns where table_name = 't1' OR table_name = 't2';
 table_catalog | table_schema | table_name | column_name | ordinal_position
---------------+--------------+------------+-------------+------------------
 postgres      | public       | t2         | a           |                1
 postgres      | public       | t1         | a           |                1
 postgres      | public       | t1         | b           |                2

I can open an issue for this.

Opening an issue wouldn't hurt.

@e-mbrown
Copy link
Contributor Author

TFTR Jane!

bors r=ZhouXing19

@craig craig bot merged commit ed9928f into cockroachdb:master Jan 26, 2023
@craig
Copy link
Contributor

craig bot commented Jan 26, 2023

Build succeeded:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants