Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bytes after 0x00 get silently truncated when importing from mysql text column to pgsql #1573

Open
7 tasks done
n0099 opened this issue Apr 11, 2024 · 0 comments
Open
7 tasks done

Comments

@n0099
Copy link

n0099 commented Apr 11, 2024

  • pgloader --version
    pgloader version "3.6.af8c3c1"
    compiled with SBCL 2.1.11.debian
    
  • did you test a fresh compile from the source tree?
  • did you search for other similar issues?
  • how can I reproduce the bug?
    LOAD DATABASE
         FROM mysql://user:@localhost/db
         INTO pgsql://user:@localhost/db
    
    WITH quote identifiers, on error stop, workers = 2, concurrency = 1, batch rows = 100, batch size = 1MB, prefetch rows = 1000
    
  • pgloader output you obtain
    2024-04-09T05:26:32.012000+08:00 LOG pgloader version "3.6.af8c3c1"                                
    2024-04-09T05:26:32.016000+08:00 LOG Data errors in '/tmp/pgloader/'                               
    2024-04-09T05:26:32.016000+08:00 LOG Parsing commands from file #P"my.load" 
    2024-04-09T05:26:32.108001+08:00 LOG Migrating from #<MYSQL-CONNECTION mysql://user@localhost:3306/db {1007FA2213}>
    2024-04-09T05:26:32.108001+08:00 LOG Migrating into #<PGSQL-CONNECTION pgsql://user@localhost:5432/db {1007FA2E33}>
    2024-04-09T09:07:46.803223+08:00 LOG report summary reset 
    
  • data that is being loaded, if relevant

    mysql

    CREATE TABLE test(t text);
    INSERT INTO test(t) VALUES (CONCAT(0x020100, '1234'));
    SELECT hex(t) FROM test;
    HEX(t)
    02010031323334
  • How the data is different from what you expected, if relevant

    pgsql

    SELECT encode(t::bytea, 'hex') FROM test;
    encode
    0201

I guessed the reason in EnterpriseDB/mysql_fdw#299, and suggest that there should be a error or warning when inserting bytes contains 0x00 to column with type text.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant