Attributes Supported by Data Types
No. |
MySQL |
GaussDB |
---|---|---|
1 |
NULL |
Supported. |
2 |
NOT NULL |
Supported. |
3 |
DEFAULT |
Supported. |
4 |
ON UPDATE |
Supported. |
4 |
PRIMARY KEY |
Supported. |
5 |
AUTO_INCREMENT |
Supported. |
6 |
CHARACTER SET name |
Supported. |
7 |
COLLATE name |
Supported. |
8 |
ZEROFILL |
Supported. |
When CREATE TABLE AS is used to create a table and default values are set for fields of the VARBINARY type, the command output of SHOW CREATE TABLE, DESC, or \d is different from that of MySQL. The value displayed in GaussDB is a hexadecimal value, but MySQL displays the original value.
m_db=# CREATE TABLE test_int( int_col INT ); m_db=# CREATE TABLE test_varbinary( varbinary_col VARBINARY(20) default 'gauss' ) AS SELECT * FROM test_int; m_db=# SHOW CREATE TABLE test_varbinary; Table | Create Table ----------------+--------------------------------------------------------------------------- test_varbinary | SET search_path = public; + | CREATE TABLE test_varbinary ( + | varbinary_col varbinary(20) DEFAULT X'6761757373', + | int_col integer + | ) + | CHARACTER SET = "UTF8" COLLATE = "utf8mb4_general_ci" + | WITH (orientation=row, compression=no, storage_type=USTORE, segment=off); (1 row) m_db=# DROP TABLE test_int, test_varbinary; mysql> CREATE TABLE test_int( int_col INT ); mysql> CREATE TABLE test_varbinary( varbinary_col VARBINARY(20) default 'gauss' ) AS SELECT * FROM test_int; mysql> SHOW CREATE TABLE test_varbinary; +----------------+--------------------------------------------------------------------------------------------------------------------+ | Table | Create Table | +----------------+--------------------------------------------------------------------------------------------------------------------+ | test_varbinary | CREATE TABLE `test_varbinary` ( `varbinary_col` varbinary(20) DEFAULT 'gauss', `int_vol` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 | +----------------+--------------------------------------------------------------------------------------------------------------------+ 1 row in set (0.00 sec) mysql> DROP TABLE test_int, test_varbinary;
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot