That's completely right. The datastructure is not defined on my own.. It is 
Spring Boots hibernate / jpa which is defining the datastructure for my 
unit tests... BUT: I cannot understand why the same query is working 
without the LOWER() function. 

CREATE TABLE TEST (ID BIGINT, SOMEVALUE CHARACTER(255));
INSERT INTO TEST (ID, SOMEVALUE) VALUES(1, 'Y');
SELECT * FROM TEST WHERE SOMEVALUE = 'Y';

is working fine... The shorted value with one character is also 
right-padded with spaces but the query is working fine... The point is that 
I am using h2 as an in-memory database for my unit tests in a spring boot 
application. The tests are the same but after upgrading to h2 v2.. my unit 
tests are failing... I fixed my issue by giving the datatype a fixed length 
of 1 but I just wanted to know if this is an unseen issue or if this is a 
wanted feature. 

The padding point is completely fine but it is confusing me that just the 
LOWER() function is caring about the blanks..

Evgenij Ryazanov schrieb am Montag, 4. Juli 2022 um 15:01:28 UTC+2:

> CHARACTER is a fixed-width data type. Columns of CHARACTER data type 
> always have exactly one character. Columns of CHARACTER(255) data type 
> always have exactly 255 characters, shorted values are right-padded with 
> spaces. If you need to store strings of different length, you should always 
> use CHARACTER VARYING / VARCHAR data type instead. If you need to store 
> exactly one character, you can use CHARACTER or CHARACTER(1); but don't 
> use CHARACTER(255) for this purpose, such choice is obliviously wrong.
>
> More details are described here:
> https://github.com/h2database/h2database/issues/3385
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/h2-database/2d6c6c55-9ff5-41b4-9d79-9e64778ad1cen%40googlegroups.com.

Reply via email to