MDEV-31414: Implement optional lengths for string types#4551
MDEV-31414: Implement optional lengths for string types#4551OsamaNabih wants to merge 1 commit intoMariaDB:mainfrom
Conversation
|
Hi,
That is a nice guess! Our documentation claims it's 21,844 characters, though I think it's a bit outdated, since we support 4-byte encodings for some time. So yes, it's got to be UINT16_MAX/4 - header_length, where header_length is something like 3. |
FooBarrior
left a comment
There was a problem hiding this comment.
We follow the TDD paradigm - every feature should be covered with tests (and every bugfix, if possible). Include both .test and .result files in the commit.
I'm fine with a hard constant of 16383 in scope of this small work, we can always extend it and make a function of charset any time we want, since 16383 is expected to be the minimum of the maximums.
|
You can try to make tha max value variable if you want. Though it may require some research. The problem is that we have (at least) three layers of charset settings:
One overrides another. At some point, Filed would get a deduced value of charset, and perhaps Create_field would get it, too. Though it's hard to say, when exactly. You'd have to test all three cases though:
Again, I'm NOT putting this as a requirement for this submission! |
That is very informative. To verify my understanding, we are okay with limiting the scope of this PR to the |
17e0e30 to
c6e985c
Compare
fe334ea to
7adad2c
Compare
b0e32ff to
03b43df
Compare
gkodinov
left a comment
There was a problem hiding this comment.
Thanks for working on this. This is a preliminary review.
Please fix some sanity checks:
- Make sure this is a single commit and it has a proper commit message, according to CODING_STANDARDS.md.
- Make sure there's no failing tests as a result of your change. I can see a couple in the buildbot results.
afe53e1 to
87cdc69
Compare
FooBarrior
left a comment
There was a problem hiding this comment.
Add more details in the commit comments. Mention SQL standard, its rule about implementation-defined lengths and describe our approach.
Remove Signed-off-by.
0a9f91e to
169b89e
Compare
FooBarrior
left a comment
There was a problem hiding this comment.
Please go through the test carefully, by yourself. Because I see that my edit requests stay unfulfilled, yet marked as resolved.
Support SQL Standard T081 allowing the length to be ommitted for types VARCHAR, NVARCHAR, and VARBINARY In case of ommitted length for these types, we dothe following: VARCHAR, NVARCHAR are mapped to TEXT type VARBINARY is mapped to BLOB type This approach provides flexibility to the users And avoids complications with charsets and future ALTER table operations
|
Note that, before being merged, this needs to go through testing. So please, have some more patience. |
gkodinov
left a comment
There was a problem hiding this comment.
I've received the following request from the QA engineer:
Please add tests for other places where the length-less type can be used:
- local stored procedure/function/trigger variables, via DECLARE
- stored procedure/function parameters
- local stored function return type
- JSON_TABLE
- dynamic columns
- virtual columns
Note that the SP test should be done in both Oracle and native mode.
I'll start looking into those |
|
This is what is needed to:
So, I guess, for this PR. Note that it's about documenting and test coverage for the current behavior. It's not about changing it yet. |
Jira: https://jira.mariadb.org/browse/MDEV-31414
Adding support for SQL standard 2023's T081:
Optional string types maximum lengthThis PR allows the user to not specify a length for a
VARCHARfield. We default to making the field aTEXTtype.