-
Notifications
You must be signed in to change notification settings - Fork 477
test: sqlness test for insert default #873
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
Merged
evenyag
merged 5 commits into
GreptimeTeam:develop
from
waynexia:sqlness-insert-default
Jan 13, 2023
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,66 @@ | ||
| CREATE TABLE test1 (i INTEGER, j BIGINT TIME INDEX, k STRING DEFAULT 'blabla'); | ||
|
|
||
| Affected Rows: 0 | ||
|
|
||
| INSERT INTO test1 VALUES (DEFAULT); | ||
|
|
||
| Error: 1004(InvalidArguments), Columns and values number mismatch, columns: 3, values: 1 | ||
|
|
||
| INSERT INTO test1 VALUES (DEFAULT, DEFAULT, DEFAULT); | ||
|
|
||
| Error: 1004(InvalidArguments), No valid default value can be build automatically, column: j | ||
|
|
||
| INSERT INTO test1 VALUES (DEFAULT, DEFAULT, DEFAULT, DEFAULT); | ||
|
|
||
| Error: 1004(InvalidArguments), Columns and values number mismatch, columns: 3, values: 4 | ||
|
|
||
| INSERT INTO test1 VALUES (DEFAULT, 1, DEFAULT), (default, 2, default), (DeFaUlT, 3, DeFaUlT), (dEfAuLt, 4, dEfAuLt); | ||
|
|
||
| Affected Rows: 4 | ||
|
|
||
| SELECT * FROM test1; | ||
|
|
||
| +---+---+--------+ | ||
| | i | j | k | | ||
| +---+---+--------+ | ||
| | | 1 | blabla | | ||
| | | 2 | blabla | | ||
| | | 3 | blabla | | ||
| | | 4 | blabla | | ||
| +---+---+--------+ | ||
|
|
||
| CREATE TABLE test2 (i INTEGER, j BIGINT TIME INDEX DEFAULT CURRENT_TIMESTAMP, k STRING DEFAULT 'blabla'); | ||
|
|
||
| Affected Rows: 0 | ||
|
|
||
| INSERT INTO test2 VALUES (1,1,'a'), (default, 2, default), (3,3,'b'), (default, 4, default), (5, 5, 'c'); | ||
|
|
||
| Affected Rows: 5 | ||
|
|
||
| INSERT INTO test2 VALUES (6, 6, default), (7, 7, 'd'), (default, 8, 'e'); | ||
|
|
||
| Affected Rows: 3 | ||
|
|
||
| SELECT * FROM test2; | ||
|
|
||
| +---+---+--------+ | ||
| | i | j | k | | ||
| +---+---+--------+ | ||
| | 1 | 1 | a | | ||
| | | 2 | blabla | | ||
| | 3 | 3 | b | | ||
| | | 4 | blabla | | ||
| | 5 | 5 | c | | ||
| | 6 | 6 | blabla | | ||
| | 7 | 7 | d | | ||
| | | 8 | e | | ||
| +---+---+--------+ | ||
|
|
||
| DROP TABLE test1; | ||
|
|
||
| Affected Rows: 1 | ||
|
|
||
| DROP TABLE test2; | ||
|
|
||
| Affected Rows: 1 | ||
|
|
||
This file contains hidden or 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,22 @@ | ||
| CREATE TABLE test1 (i INTEGER, j BIGINT TIME INDEX, k STRING DEFAULT 'blabla'); | ||
|
|
||
| INSERT INTO test1 VALUES (DEFAULT); | ||
|
|
||
| INSERT INTO test1 VALUES (DEFAULT, DEFAULT, DEFAULT); | ||
|
|
||
| INSERT INTO test1 VALUES (DEFAULT, DEFAULT, DEFAULT, DEFAULT); | ||
|
|
||
| INSERT INTO test1 VALUES (DEFAULT, 1, DEFAULT), (default, 2, default), (DeFaUlT, 3, DeFaUlT), (dEfAuLt, 4, dEfAuLt); | ||
|
|
||
| SELECT * FROM test1; | ||
|
|
||
| CREATE TABLE test2 (i INTEGER, j BIGINT TIME INDEX DEFAULT CURRENT_TIMESTAMP, k STRING DEFAULT 'blabla'); | ||
|
|
||
| INSERT INTO test2 VALUES (1,1,'a'), (default, 2, default), (3,3,'b'), (default, 4, default), (5, 5, 'c'); | ||
|
|
||
| INSERT INTO test2 VALUES (6, 6, default), (7, 7, 'd'), (default, 8, 'e'); | ||
|
|
||
| SELECT * FROM test2; | ||
|
|
||
| DROP TABLE test1; | ||
| DROP TABLE test2; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.