Open n0099 opened 2 months ago
CREATE TABLE test(t text); INSERT INTO test(t) VALUES (CONCAT(0x020100, '1234')); SELECT hex(t) FROM test;
CREATE FOREIGN TABLE IF NOT EXISTS test(t text) SERVER mysql OPTIONS (dbname 'db', table_name 'test'); SELECT encode(t::bytea, 'hex') FROM test;
all bytes after 0x00 and itself are removed, but it will be complete fetched when using bytea as field type:
0x00
bytea
CREATE FOREIGN TABLE IF NOT EXISTS test(t bytea) SERVER mysql OPTIONS (dbname 'db', table_name 'test'); SELECT encode(t::bytea, 'hex') FROM test;
It's seems related to https://github.com/confluentinc/kafka-connect-jdbc/issues/1216 as postgresql doesn't support storing 0x00 in text unlike mysql due to c-style NUL-terminated string https://stackoverflow.com/questions/1347646/postgres-error-on-insert-error-invalid-byte-sequence-for-encoding-utf8-0x0 https://postgrespro.com/list/thread-id/1897280
text
mysql side
pgsql side
all bytes after
0x00
and itself are removed, but it will be complete fetched when usingbytea
as field type:It's seems related to https://github.com/confluentinc/kafka-connect-jdbc/issues/1216 as postgresql doesn't support storing
0x00
intext
unlike mysql due to c-style NUL-terminated string https://stackoverflow.com/questions/1347646/postgres-error-on-insert-error-invalid-byte-sequence-for-encoding-utf8-0x0 https://postgrespro.com/list/thread-id/1897280