Updated on 2025-04-14 GMT+08:00

Attributes Supported by Data Types

Table 1 Attributes Supported by Data Types

Attributes Supported by Data Types

NULL

NOT NULL

DEFAULT

ON UPDATE

PRIMARY KEY

AUTO_INCREMENT

CHARACTER SET name

COLLATE name

ZEROFILL

Difference:

During table creation, default values are set for fields of the VARBINARY type. When querying the table structure using DESC or similar methods, GaussDB displays the converted hexadecimal values, whereas MySQL displays original values.

Example:
-- GaussDB
m_db=# CREATE TABLE test_varbinary(a varbinary(20) DEFAULT 'GaussDB');
CREATE TABLE

m_db=# DESC test_varbinary;
 Field |     Type      | Null | Key |      Default      | Extra 
-------+---------------+------+-----+-------------------+-------
 a     | varbinary(20) | YES  |     | X'47617573734442' | 
(1 row)

m_db=# DROP TABLE test_varbinary;
DROP TABLE

-- MySQL
mysql> CREATE TABLE test_varbinary(a varbinary(20) DEFAULT 'GaussDB');
Query OK, 0 rows affected (0.02 sec)

mysql> DESC test_varbinary;
+-------+---------------+------+-----+---------+-------+
| Field | Type          | Null | Key | Default | Extra |
+-------+---------------+------+-----+---------+-------+
| a     | varbinary(20) | YES  |     | GaussDB |       |
+-------+---------------+------+-----+---------+-------+
1 row in set (0.00 sec)

mysql> DROP TABLE test_varbinary;
Query OK, 0 rows affected (0.01 sec)