Binary Data Types

Table 1 lists the binary data types supported by openGauss.

Table 1 Binary data types

Name

Description

Storage Space

BLOB

Binary large object

NOTE:

Column storage cannot be used for the BLOB type.

The maximum size is 8,203 bytes less than 1 GB, namely, 1,073,733,621 bytes.

RAW

Variable-length hexadecimal string

NOTE:

Column storage cannot be used for the raw type.

4 bytes plus the actual hexadecimal string. The maximum size is 8,203 bytes less than 1 GB, namely, 1,073,733,621 bytes.

BYTEA

Variable-length binary string

4 bytes plus the actual binary string. The maximum size is 8,203 bytes less than 1 GB, namely, 1,073,733,621 bytes.

NOTE: In addition to the size limitation on each column, the total size of each tuple is 8,203 bytes less than 1 GB, namely, 1,073,733,621 bytes.

An example is provided as follows:

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

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

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

-- Delete the table.
postgres=# DROP TABLE blob_type_t1;
Feedback
编组 3备份
    openGauss 2024-05-06 00:44:54
    cancel