HomeMogDBMogDB StackUqbar
v5.0

Documentation:v5.0

Supported Versions:

Other Versions:

Binary Types

Table 1 lists the binary data types supported by MogDB.

Compared with the original MogDB, Dolphin modifies the binary types as follows:

  1. The BINARY, VARBINARY, TINYBLOB, MEDIUMBLOB, and LONGBLOB types are added.
  2. The input function of the BLOB type is modified. When dolphin.b_compatibility_mode is set to on, the input function is compatible with the common character string input of the MySQL database. The corresponding character string can be output only when bytea_output is set to escape; otherwise, the value will be converted into a hexadecimal character string for output.
  3. For the TINYBLOB, MEDIUMBLOB, and LONGBLOB types, if dolphin.b_compatibility_mode is set to off, the input function is still compatible with the common character string input of the MySQL database. The corresponding character string can be output only when bytea_output is set to escape; otherwise, the character string will be converted into a hexadecimal character string for output.
  4. The input function of the BINARY type is modified to support the identification of escape characters in the MySQL database.
  5. The BIANRY EXPR is added. The BINARY keyword before any expression indicates that the expression is converted to the binary type.

Table 1 Binary data types

Name Description Storage Space
BLOB Binary large object (BLOB).
NOTE:
Column store does not support the BLOB type.TheThe input function of the BLOB type is compatible with the MySQL database's function of receiving common character strings only when dolphin.b_compatibility_mode is set to on.
The maximum size is 1GB-8203 bytes (that is, 1073733621 bytes).
BLOB Binary large object (BLOB).
NOTE:
Column store does not support the TINYBLOB type.TheThe input function of the TINYBLOB type is still compatible with the MySQL database's function of receiving common character strings even if dolphin.b_compatibility_mode is set to off.
The maximum size is 255 bytes.
MEDIUMBLOB Binary large object (BLOB).
NOTE:
Column store does not support the MEDIUMBLOB type.TheThe input function of the MEDIUMBLOB type is still compatible with the MySQL database's function of receiving common character strings even if dolphin.b_compatibility_mode is set to off.
The maximum size is 16 MB – 1 byte.
LONGBLOB Binary large object (BLOB).
NOTE:
Column store does not support the LONGBLOB type.TheThe input function of the LONGBLOB type is still compatible with the MySQL database's function of receiving common character strings even if dolphin.b_compatibility_mode is set to off.
The maximum size is 4 GB – 1 byte.
RAW Variable-length hexadecimal string.
NOTE:
Column store does not support the raw type.
4 bytes plus the actual hexadecimal string. Its maximum length is 1 GB – 8203 bytes (that is, 1073733621 bytes).
BYTEA Variable-length binary string. 4 bytes plus the actual binary string. Its maximum length is 1 GB – 8203 bytes (that is, 1073733621 bytes).
BINARY Fixed-length binary string. 4 bytes plus the actual binary string (255 bytes). The maximum length is 259 bytes.
VARBINARY Variable-length binary string. 4 bytes plus the actual binary string (65535 bytes). The maximum length is 65539 bytes.
BYTEAWITHOUTORDERWITHEQUALCOL Variable-length binary character string (new type for the encryption feature. If the encryption type of the encrypted column is specified as deterministic encryption, the column type is BYTEAWITHOUTORDERWITHEQUALCOL). The original data type is displayed when the encrypted table is printed by running the meta command. 4 bytes plus the actual binary string. The maximum value is 1 GB – 53 bytes (that is, 1073741771 bytes).
BYTEAWITHOUTORDERCOL Variable-length binary character string (new type for the encryption feature. If the encryption type of the encrypted column is specified as random encryption, the column type is BYTEAWITHOUTORDERCOL). The original data type is displayed when the encrypted table is printed by running the meta command. 4 bytes plus the actual binary string. The maximum value is 1 GB – 53 bytes (that is, 1073741771 bytes).
_BYTEAWITHOUTORDERWITHEQUALCOL Variable-length binary character string, which is a new type for the encryption feature. 4 bytes plus the actual binary string. The maximum value is 1 GB – 53 bytes (that is, 1073741771 bytes).
_BYTEAWITHOUTORDERCOL Variable-length binary character string, which is a new type for the encryption feature. 4 bytes plus the actual binary string. The maximum value is 1 GB – 53 bytes (that is, 1073741771 bytes).

img NOTE:

  • In addition to the size limit of each column, the total size of each tuple cannot exceed 1 GB – 8203 bytes (that is, 1073733621 bytes).
  • BYTEAWITHOUTORDERWITHEQUALCOL, BYTEAWITHOUTORDERCOL, _BYTEAWITHOUTORDERWITHEQUALCOL, and _BYTEAWITHOUTORDERCOL cannot be directly used to create a table.

Example:

--Create a table.
MogDB=#  CREATE TABLE blob_type_t1 
(
    BT_COL1 INTEGER,
    BT_COL2 BLOB,
    BT_COL3 RAW,
    BT_COL4 BYTEA
) ;

--Insert data.
MogDB=#  INSERT INTO blob_type_t1 VALUES(10,empty_blob(),
HEXTORAW('DEADBEEF'),E'\\xDEADBEEF');

--Query data in the table.
MogDB=#  SELECT * FROM blob_type_t1;
 bt_col1 | bt_col2 | bt_col3  |  bt_col4   
---------+---------+----------+------------
      10 |         | DEADBEEF | \xdeadbeef
(1 row)

--Delete the table.
MogDB=#  DROP TABLE blob_type_t1;

--Use BINARY to convert data.
MogDB=# select 'a\t'::binary;
 binary
--------
 \x6109
(1 row)

MogDB=# select binary 'a\b';
 binary
--------
 \x6108
(1 row)
Copyright © 2011-2024 www.enmotech.com All rights reserved.