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

data is not correct when copy mysql blob data into postgresql bytea #160

Open
giant-ksj opened this issue Apr 27, 2023 · 1 comment
Open

Comments

@giant-ksj
Copy link

giant-ksj commented Apr 27, 2023

Describe the bug
A clear and concise description of what the bug is.

Source - MySQL

show create table test;
+-------+------------------------------------------------------------------------------------------+
| Table | Create Table                                                                             |
+-------+------------------------------------------------------------------------------------------+
| test  | CREATE TABLE `test` (
  `id` int NOT NULL,
  `testcol` blob,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci |
+-------+------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)


select * from test;
+----+------------------+
| id | testcol          |
+----+------------------+
|  1 | 0x31             |
+----+------------------+
1 row in set (0.00 sec)

Target - PostgreSQL

\d+ test
                                  Table "public.test"
 Column  |  Type   | Collation | Nullable | Default | Storage  | Stats target | Description
---------+---------+-----------+----------+---------+----------+--------------+-------------
 id      | integer |           | not null |         | plain    |              |
 testcol | bytea   |           |          |         | extended |              |
Indexes:
    "test_pkey" PRIMARY KEY, btree (id)
Access method: heap


select * from test;
 id | testcol
----+---------
  1 | \x3331

when mysql_fdw appear same data with mysql.

select * from mysql_fdw.test;
 id | testcol
----+---------
  1 | \x31

which is correct?

To Reproduce
Steps to reproduce the behavior:

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment(please complete the following information):

  • OS: [e.g. Devuan GNU/Linux]
  • MySQL Version[e.g. 5.7.27]
  • PostgreSQL Version[e.g. 11]
  • Python Version [e.g. 3.5]
  • Cloud hosted database [e.g PostgreSQL on AWS RDS and MySQL on Google Cloud]

Additional context
Add any other context about the problem here.

@bukem
Copy link

bukem commented May 16, 2023

Hello,

The removing blob from the hexify_always list seems to address our similar issue

self.hexify_always = ['blob', 'tinyblob', 'mediumblob','longblob','binary','varbinary']
.
Just not sure how appropriate is this fix.
What are the risks of excluding blob from this list?

Thank you,
Mikhail

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

2 participants