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

Improve error message when column doesn't have default #2512

Closed
NiwakaDev opened this issue Sep 27, 2023 · 2 comments
Closed

Improve error message when column doesn't have default #2512

NiwakaDev opened this issue Sep 27, 2023 · 2 comments
Labels
C-enhancement Category Enhancements

Comments

@NiwakaDev
Copy link
Collaborator

What type of enhancement is this?

User experience

What does the enhancement do?

Improve an error message when a column doesn't have default.

Let's say that we have the following table:

create table test_table(a string not null, ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP);

And then, The following sql:

insert into test_table values(default, default);

results in:

ERROR 1815 (HY000): Failed to execute query, query: insert into test_table values(default, default)

This error doesn't tell us that the a doesn't have default.

I think that we can improve the error message like this:

`a` doesn't have a default value

Implementation challenges

No response

@NiwakaDev NiwakaDev added the C-enhancement Category Enhancements label Sep 27, 2023
@evenyag
Copy link
Contributor

evenyag commented Sep 29, 2023

I guess the server doesn't return the root cause due to #2428

ERROR 1815 (HY000): Failed to execute query, query: insert into test_table values(default, default)

After #2506 is merged, the latest commit should output the reason

mysql> insert into test_table values(default, default);
ERROR 1815 (HY000): No valid default value can be built automatically, column: a

@NiwakaDev
Copy link
Collaborator Author

I see. Thank you.

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

No branches or pull requests

2 participants