Giter Site home page Giter Site logo

Comments (18)

ahsanhadi avatar ahsanhadi commented on August 13, 2024

Can you please share the ddl that we can use to reproduce this issue?

On Sat, Jan 17, 2015 at 8:54 AM, cwsteinbach [email protected]
wrote:

I am trying to use the mysql_fdw with several MySQL tables that contain
BLOB and LONGBLOB fields. I mapped these fields to BYTEA and TEXT fields in
the corresponding Postgres foreign table. Queries against the corresponding
FTs run to completion, but it looks like each of the BYTEA and TEXT fields
is getting truncated after the first three bytes.

Does the mysql_fdw currently support BLOB and LONGBLOB fields, and if so,
what is the correct way of accessing these fields through the corresponding
foreign table?


Reply to this email directly or view it on GitHub
#37.

Ahsan Hadi
Snr Director Product Development
EnterpriseDB Corporation
The Enterprise Postgres Company

Phone: +92-51-8358874
Mobile: +92-333-5162114

Website: www.enterprisedb.com
EnterpriseDB Blog: http://blogs.enterprisedb.com/
Follow us on Twitter: http://www.twitter.com/enterprisedb

This e-mail message (and any attachment) is intended for the use of the
individual or entity to whom it is addressed. This message contains
information from EnterpriseDB Corporation that may be privileged,
confidential, or exempt from disclosure under applicable law. If you are
not the intended recipient or authorized to receive this for the intended
recipient, any use, dissemination, distribution, retention, archiving, or
copying of this communication is strictly prohibited. If you have received
this e-mail in error, please notify the sender immediately by reply e-mail
and delete this message.

from mysql_fdw.

erwa avatar erwa commented on August 13, 2024

For example, in the source MySQL table, we have a field with type longblob. In the Postgres foreign table, we've used type BYTEA:

CREATE FOREIGN TABLE my_server.my_table (
  ...
  blob_field BYTEA
)
SERVER
    my_server
OPTIONS (
    dbname 'my_db',
    table_name 'my_table'
);

As @cwsteinbach mentioned above, when we query our foreign table my_server.my_table, only the first 3 bytes of the blob_field are returned.

from mysql_fdw.

cimmanon avatar cimmanon commented on August 13, 2024

Hm, I have a MySQL tables with BLOBs in them and they appear normal to me (ie. they contain more than 3 bytes) when I query from PostgreSQL. It doesn't look like I'm doing anything different. PSQL version 9.4beta3 if that matters.

from mysql_fdw.

erwa avatar erwa commented on August 13, 2024

I think I know what's causing the problem for us. We're gzipping the data before inserting into the MySQL blob field. So we're doing something like this:

String testString = "today is january 22, 2015.";
byte[] data = testString.getBytes("UTF-8");
byte[] gzippedData = gzipBytes(data, 0, data.length);

String sql = "update my_table set blobfield=? where id=?";
PreparedStatement ps = connection.prepareStatement(sql);
ps.setObject(1, gzippedData);
ps.setObject(2, myId);
ps.executeUpdate();

When you then try to select from the foreign table in Postgres, you get \x1f8b08 as the result while from the MySQL shell, you get the full binary blob.

If I insert the non-gzipped data (data above), I get all the bytes when querying from Postgres.

from mysql_fdw.

erwa avatar erwa commented on August 13, 2024

Can you add support for reading gzipped data in blob fields? Any idea why it's currently not working?

from mysql_fdw.

cwsteinbach avatar cwsteinbach commented on August 13, 2024

The root cause of this symptom is the function mysql_convert_to_pg() and its use of CStringGetDatum() to copy the field values from the mysql resultset over to postgres's row tuple. This works for BLOBs as long as the value is a null terminated string. Otherwise, the BLOB value is truncated at the first occurrence of '\0'.

We can fix this by adding some code to mysql_convert_to_pg() that sets the length of the BYTEA fields based on the value obtained from the MYSQL_BIND handle. I'm working on a patch that does this and will submit a pull request when I'm satisfied that it works.

from mysql_fdw.

mfuhrmeisterDM avatar mfuhrmeisterDM commented on August 13, 2024

Is there any progress? I also have this problem.

from mysql_fdw.

ahsanhadi avatar ahsanhadi commented on August 13, 2024

I believe Stein was going to submit a patch?

On Mon, Feb 16, 2015 at 8:55 AM, Matthias Fuhrmeister <
[email protected]> wrote:

Is there any progress? I also have this problem.


Reply to this email directly or view it on GitHub
#37 (comment)
.

Ahsan Hadi
Snr Director Product Development
EnterpriseDB Corporation
The Enterprise Postgres Company

Phone: +92-51-8358874
Mobile: +92-333-5162114

Website: www.enterprisedb.com
EnterpriseDB Blog: http://blogs.enterprisedb.com/
Follow us on Twitter: http://www.twitter.com/enterprisedb

This e-mail message (and any attachment) is intended for the use of the
individual or entity to whom it is addressed. This message contains
information from EnterpriseDB Corporation that may be privileged,
confidential, or exempt from disclosure under applicable law. If you are
not the intended recipient or authorized to receive this for the intended
recipient, any use, dissemination, distribution, retention, archiving, or
copying of this communication is strictly prohibited. If you have received
this e-mail in error, please notify the sender immediately by reply e-mail
and delete this message.

from mysql_fdw.

cwsteinbach avatar cwsteinbach commented on August 13, 2024

I created a pull request for the patch: #40

I verified that the patch works, but I still need to do some more cleanup work before it gets committed.

from mysql_fdw.

ahsanhadi avatar ahsanhadi commented on August 13, 2024

On Wed, Feb 18, 2015 at 2:31 AM, cwsteinbach [email protected]
wrote:

I created a pull request for the patch: #40
#40

The verified that the patch works, but I still need to do some more
cleanup work before it gets committed.

This is great.

We will also review and test before it is committed...


Reply to this email directly or view it on GitHub
#37 (comment)
.

Ahsan Hadi
Snr Director Product Development
EnterpriseDB Corporation
The Enterprise Postgres Company

Phone: +92-51-8358874
Mobile: +92-333-5162114

Website: www.enterprisedb.com
EnterpriseDB Blog: http://blogs.enterprisedb.com/
Follow us on Twitter: http://www.twitter.com/enterprisedb

This e-mail message (and any attachment) is intended for the use of the
individual or entity to whom it is addressed. This message contains
information from EnterpriseDB Corporation that may be privileged,
confidential, or exempt from disclosure under applicable law. If you are
not the intended recipient or authorized to receive this for the intended
recipient, any use, dissemination, distribution, retention, archiving, or
copying of this communication is strictly prohibited. If you have received
this e-mail in error, please notify the sender immediately by reply e-mail
and delete this message.

from mysql_fdw.

ahsanhadi avatar ahsanhadi commented on August 13, 2024

Are you planning to submit a final patch that we can review?

from mysql_fdw.

cwsteinbach avatar cwsteinbach commented on August 13, 2024

Yes, I plan to get the final version submitted for review by the end of the
week.

On Wed, Mar 4, 2015 at 3:03 AM, Ahsan Hadi [email protected] wrote:

Are you planning to submit a final patch that we can review?


Reply to this email directly or view it on GitHub
#37 (comment)
.

from mysql_fdw.

ahsanhadi avatar ahsanhadi commented on August 13, 2024

Please submit the final version or give us the permission to cleanup the patch and commit it.

from mysql_fdw.

ddd-malay avatar ddd-malay commented on August 13, 2024

I am facing problem with conversion from mysql binary(8) to postgresql bytea while using mysql_fdw. Please see the problem statement here:
http://stackoverflow.com/questions/32203372/mysql-fdw-input-syntax-error

Please let me whether the issue will be covered in the present "bug" or a new one has to be reported.

from mysql_fdw.

ahsanhadi avatar ahsanhadi commented on August 13, 2024

We will get the fix committed for this issue this week.

On Wed, Aug 26, 2015 at 11:13 AM, ddd-malay [email protected]
wrote:

I am facing problem with conversion from mysql binary(8) to postgresql
bytea while using mysql_fdw. Please see the problem statement here:
http://stackoverflow.com/questions/32203372/mysql-fdw-input-syntax-error

Please let me whether the issue will be covered in the present "bug" or a
new one has to be reported.


Reply to this email directly or view it on GitHub
#37 (comment)
.

Ahsan Hadi
Snr Director Product Development
EnterpriseDB Corporation
The Enterprise Postgres Company

Phone: +92-51-8358874
Mobile: +92-333-5162114

Website: www.enterprisedb.com
EnterpriseDB Blog: http://blogs.enterprisedb.com/
Follow us on Twitter: http://www.twitter.com/enterprisedb

This e-mail message (and any attachment) is intended for the use of the
individual or entity to whom it is addressed. This message contains
information from EnterpriseDB Corporation that may be privileged,
confidential, or exempt from disclosure under applicable law. If you are
not the intended recipient or authorized to receive this for the intended
recipient, any use, dissemination, distribution, retention, archiving, or
copying of this communication is strictly prohibited. If you have received
this e-mail in error, please notify the sender immediately by reply e-mail
and delete this message.

from mysql_fdw.

ibrarahmad avatar ibrarahmad commented on August 13, 2024

commited

from mysql_fdw.

ddd-malay avatar ddd-malay commented on August 13, 2024

Will it be effective for mapping MySQL BINARY to PostgreSQL Bytea?

from mysql_fdw.

ahsanhadi avatar ahsanhadi commented on August 13, 2024

On Saturday, August 29, 2015, ddd-malay [email protected] wrote:

Will it be effective for mapping MySQL BINARY to PostgreSQL Bytea?

Yes.


Reply to this email directly or view it on GitHub
#37 (comment)
.

Ahsan Hadi
Snr Director Product Development
EnterpriseDB Corporation
The Enterprise Postgres Company

Phone: +92-51-8358874
Mobile: +92-333-5162114

Website: www.enterprisedb.com
EnterpriseDB Blog: http://blogs.enterprisedb.com/
Follow us on Twitter: http://www.twitter.com/enterprisedb

This e-mail message (and any attachment) is intended for the use of the
individual or entity to whom it is addressed. This message contains
information from EnterpriseDB Corporation that may be privileged,
confidential, or exempt from disclosure under applicable law. If you are
not the intended recipient or authorized to receive this for the intended
recipient, any use, dissemination, distribution, retention, archiving, or
copying of this communication is strictly prohibited. If you have received
this e-mail in error, please notify the sender immediately by reply e-mail
and delete this message.

from mysql_fdw.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.