Empty Varchar Field causes Query issues
If you create a test table and populate it as below
DROP TABLE IF EXISTS debugging_table
;
CREATE TABLE debugging_table
(
id
int(11) NOT NULL,
columnA
varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
columnB
varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
columnC
varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
PRIMARY KEY (id
) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- Records of debugging_table
INSERT INTO debugging_table
VALUES (1, '', 'g', 'fggg');
INSERT INTO debugging_table
VALUES (2, 'jj', 'test 2 column b', 'test 2 column c');
INSERT INTO debugging_table
VALUES (3, 'test 3 column a', 'test 3 column b', 'test 3 column c');
INSERT INTO debugging_table
VALUES (4, 'test 4 column a', 'test 4 column b', 'test 4 column c');
And then execute the following query... SELECT debugging_table.columnA, debugging_table.columnB, debugging_table.columnC FROM debugging_table
It will return nothing and not throw an error.