forked from cockroachdb/cockroach
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request cockroachdb#130890 from mgartner/backport24.1-129007
release-24.1: opt: fix BPCHAR type and CASE typing
- Loading branch information
Showing
28 changed files
with
312 additions
and
117 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
query T | ||
SELECT 'foo'::BPCHAR | ||
---- | ||
foo | ||
|
||
statement ok | ||
CREATE TABLE t (c BPCHAR PRIMARY KEY, FAMILY (c)) | ||
|
||
statement ok | ||
INSERT INTO t VALUES ('foo'), ('ba'), ('c'), ('foobarbaz') | ||
|
||
query T rowsort | ||
SELECT c FROM t | ||
---- | ||
foo | ||
ba | ||
c | ||
foobarbaz | ||
|
||
query T | ||
SELECT create_statement FROM [SHOW CREATE TABLE t] | ||
---- | ||
CREATE TABLE public.t ( | ||
c BPCHAR NOT NULL, | ||
CONSTRAINT t_pkey PRIMARY KEY (c ASC), | ||
FAMILY fam_0_c (c) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# LogicTest: local | ||
|
||
# Regression test for #127889. CASE-like expressions should not impose type | ||
# widths of one branch on other branches. | ||
subtest regression_127889 | ||
|
||
query T | ||
SELECT CASE WHEN true THEN 'foo'::TEXT ELSE 'b'::CHAR END | ||
---- | ||
foo | ||
|
||
query T | ||
SELECT COALESCE(NULL::CHAR, 'bar'::CHAR(2)) | ||
---- | ||
ba | ||
|
||
query T | ||
SELECT IF(false, 'foo'::CHAR, 'bar'::CHAR(2)) | ||
---- | ||
ba | ||
|
||
query T | ||
SELECT CASE WHEN false THEN 'b'::CHAR ELSE 'foo'::TEXT END | ||
---- | ||
foo | ||
|
||
query T | ||
SELECT (CASE WHEN false THEN 'b'::CHAR ELSE 'foo'::TEXT END)::CHAR | ||
---- | ||
f | ||
|
||
query T | ||
SELECT (CASE WHEN false THEN 'b'::CHAR ELSE 'foo'::TEXT END)::BPCHAR | ||
---- | ||
foo | ||
|
||
query R | ||
SELECT CASE WHEN true THEN 1.2345::DECIMAL(5, 4) ELSE NULL::DECIMAL(10, 2) END | ||
---- | ||
1.2345 | ||
|
||
query R | ||
SELECT CASE WHEN false THEN NULL::DECIMAL(10, 2) ELSE 1.2345::DECIMAL(5, 4) END | ||
---- | ||
1.2345 | ||
|
||
subtest end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
pkg/sql/logictest/tests/local-legacy-schema-changer/generated_test.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.