Bug in char_length() in 7.0?

Started by Frank P. Milesalmost 26 years ago1 messagesgeneral
Jump to latest
#1Frank P. Miles
fpmi@home.com

char_length() no longer seems to be working for me (at least with my
current build).

For example, create a simple test table and populate it with some
values:

CREATE TABLE test (
f1 character(4) NOT NULL,
f2 varchar(20),
PRIMARY KEY (f1)
);

INSERT INTO test VALUES ('a', 'field a');
INSERT INTO test VALUES ('b', 'field b');
INSERT INTO test VALUES ('cc', 'field c');
INSERT INTO test VALUES ('dd', 'field d');
INSERT INTO test VALUES ('eee', 'field e');
INSERT INTO test VALUES ('fff', 'field f');
INSERT INTO test VALUES ('gggg', 'field g');
INSERT INTO test VALUES ('hhhh', 'field h');

Now use the selection:

SELECT * FROM test WHERE char_length(f1) = 2;

No results are returned. If the selection:

SELECT * FROM test WHERE char_length(f1) = 4;

is used, *all rows* are returned. Has the definition
of char_length been changed since 6.5.x? Is there
some other function to take its place?

Thanks...
-frank