E
E
eldar_web2019-08-22 17:22:25
MySQL
eldar_web, 2019-08-22 17:22:25

How to convert MySQL binary type with its values ​​to PgSQL?

The question is about the MySQL binary type and its values ​​for correct conversion to PgSQL.
There are MySQL code options:
1:

CREATE TABLE "table" ( "field" binary(1) );
INSERT INTO "table" VALUES ('1', '5', '3');

2:
CREATE TABLE "table2" ( "field" binary(1) );
INSERT INTO "table2" VALUES ('A', 'F', 'C');

3:
CREATE TABLE "table3" ( "field" binary(32) );
INSERT INTO "table3" VALUES ('\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0'),('\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0'),('\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0^A '),('\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0^B ')

The first one specifies binary(1), while the INSERT specifies string values ​​as numbers.
In the second one, too, binary(1), and in INSERT, string values ​​as letters.
The third specifies binary(32), and the INSERT specifies some symbols.
What does it all mean? And how correctly to write down for PgSQL?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dimonchik, 2019-08-22
@dimonchik2013

what's the question?
data is inserted into the database

S
Sergey c0re, 2019-08-22
@erge

See Data Types in PostgreSQL
in PostgreSQL is bytea data type - Binary Data Types

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question