[openGauss 学废系列]- openGauss学习笔记整理 - 熟练掌握gsql工具的使用

embedded/2024/12/20 20:27:28/

一、学习目标

这节课是本次实训第二节课程,本次课的重点是熟练掌握gsql工具的使用。熟悉Oracle的人可能都很熟悉sqlplus工具,gsql类似于Oracle的sqlplus,gsql是openGauss数据库提供的在命令行下连接数据库的工具,可通过gsql工具连接数据库服务器并进行相关数据库操作,其除了具有可操作数据库的基本功能,还提供了很多高级特性,方便用户使用。

1.1 gsql命令

如果想充分的了解gsql命令及其参数具体含义,可通过gsql --help来查看。

[omm@opengauss-node1 ~]$ gsql --help
gsql is the openGauss interactive terminal.Usage:gsql [OPTION]... [DBNAME [USERNAME]]General options:-c, --command=COMMAND             run only single command (SQL or internal) and exit-d, --dbname=DBNAME               database name to connect to (default: "omm")-f, --file=FILENAME               execute commands from file, then exit-l, --list                        list available databases, then exit-v, --set=, --variable=NAME=VALUEset gsql variable NAME to VALUE-V, --version                     output version information, then exit-X, --no-gsqlrc                   do not read startup file (~/.gsqlrc)-1 ("one"), --single-transactionexecute command file as a single transaction-?, --help                        show this help, then exitInput and output options:-a, --echo-all                    echo all input from script-e, --echo-queries                echo commands sent to server-E, --echo-hidden                 display queries that internal commands generate-k, --with-key=KEY                the key for decrypting the encrypted file-L, --log-file=FILENAME           send session log to file-m, --maintenance                 can connect to cluster during 2-pc transaction recovery-n, --no-libedit                  disable enhanced command line editing (libedit)-o, --output=FILENAME             send query results to file (or |pipe)-q, --quiet                       run quietly (no messages, only query output)-C, --enable-client-encryption            enable client encryption feature-s, --single-step                 single-step mode (confirm each query)-S, --single-line                 single-line mode (end of line terminates SQL command)Output format options:-A, --no-align                    unaligned table output mode-F, --field-separator=STRINGset field separator (default: "|")-H, --html                        HTML table output mode-P, --pset=VAR[=ARG]              set printing option VAR to ARG (see \pset command)-R, --record-separator=STRINGset record separator (default: newline)-r                                if this parameter is set,use libedit -t, --tuples-only                 print rows only-T, --table-attr=TEXT             set HTML table tag attributes (e.g., width, border)-x, --expanded                    turn on expanded table output-z, --field-separator-zeroset field separator to zero byte-0, --record-separator-zeroset record separator to zero byte-2, --pipeline                    use pipeline to pass the password, forbidden to use in terminalmust use with -c or -fConnection options:-h, --host=HOSTNAME               database server host or socket directory (default: "/opt/gaussdb/tmp")allow multi host IP address with comma separator in centralized cluster-p, --port=PORT                   database server port (default: "5432")-U, --username=USERNAME           database user name (default: "omm")-W, --password=PASSWORD           the password of specified database userFor more information, type "\?" (for internal commands) or "\help" (for SQL
commands) from within gsql, or consult the gsql section in the openGauss documentation.

每个命令的具体含义还可以通过openGauss官网 https://docs.opengauss.org/zh/docs/3.1.0-lite/docs/Toolreference/gsql.html去查询gsql更详细的使用。

1.2 常用gsql命令及其含义

以下gsql常用命令及其含义,如下表:

元命令具体含义
\l列出所有可用的数据库,然后退出
\conninfo显示会话的连接信息
\c\ DBNAME 是切换连接到该数据库
\du显示数据库集簇中目前有哪些用户和角色
\dgdg用法同du
\db显示当前数据库集簇中目前有哪些表空间
\dn显示当前数据库有哪些数据库模式
\dt显示当前数据库中所有的表
\d TableName查看某个表信息
\d IndexName查看某个索引信息
\di显示关系列表
x打开扩展表格式模式
\r提供了对gsql命令的历史版本支持

二、课程作业

2.1 gsql命令连到数据库omm

-- 使用 gsql -d 数据库名 -p 端口号 来连接数据库
-- 如下所示通过26000端口连接postgres数据库
[omm@opengauss-node1 ~]$ gsql -d postgres -p 26000
gsql ((openGauss 3.1.0 build 4e931f9a) compiled at 2022-09-29 14:19:24 commit 0 last mr  )
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.

image.png

2.2 查看数据库的版本及版权信息

[omm@opengauss-node1 ~]$ gsql -d postgres -p 26000 -r
gsql ((openGauss 3.1.0 build 4e931f9a) compiled at 2022-09-29 14:19:24 commit 0 last mr  )
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.-- 显示openGauss数据库版本信息
openGauss=# select version();version                                                                        
------------------------------------------------------------------------------------------------------------------------------------------------------(openGauss 3.1.0 build 4e931f9a) compiled at 2022-09-29 14:19:24 commit 0 last mr   on x86_64-unknown-linux-gnu, compiled by g++ (GCC) 7.3.0, 64-bit
(1 row)-- 显示openGauss基于pg哪个版本开发的
openGauss=# show server_version;  server_version 
----------------9.2.4
(1 row)-- 显示版权信息
openGauss=# \copyright
GaussDB Kernel Database Management System
Copyright (c) Huawei Technologies Co., Ltd. 2018. All rights reserved.

image.png

2.3 常见元命令使用

[omm@opengauss-node1 ~]$ gsql -d postgres -p 26000
gsql ((openGauss 3.1.0 build 4e931f9a) compiled at 2022-09-29 14:19:24 commit 0 last mr  )
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.-- \l 列出所有可用的数据库,然后退出
openGauss=# \lList of databasesName    |  Owner  | Encoding | Collate | Ctype | Access privileges 
-----------+---------+----------+---------+-------+-------------------postgres  | omm     | UTF8     | C       | C     | presdb    | preuser | UTF8     | C       | C     | template0 | omm     | UTF8     | C       | C     | =c/omm           +|         |          |         |       | omm=CTc/ommtemplate1 | omm     | UTF8     | C       | C     | =c/omm           +|         |          |         |       | omm=CTc/omm
(4 rows)-- \conninfo 显示会话的连接信息
openGauss=# \conninfo 
You are connected to database "postgres" as user "omm" via socket in "/opt/gaussdb/tmp" at port "26000".-- \c presdb 是切换连接到presdb数据库
openGauss=# \c presdb
Non-SSL connection (SSL connection is recommended when requiring high-security)
You are now connected to database "presdb" as user "omm".-- \du 显示数据库集簇中目前有哪些用户和角色
presdb=# \duList of rolesRole name |                                                    Attributes                                                    | Member of 
-----------+------------------------------------------------------------------------------------------------------------------+-----------omm       | Sysadmin, Create role, Create DB, Replication, Administer audit, Monitoradmin, Operatoradmin, Policyadmin, UseFT | {}preuser   | Sysadmin                                                                                                         | {}-- 同\dg 显示数据库集簇中目前有哪些用户和角色
presdb=# \dgList of rolesRole name |                                                    Attributes                                                    | Member of 
-----------+------------------------------------------------------------------------------------------------------------------+-----------omm       | Sysadmin, Create role, Create DB, Replication, Administer audit, Monitoradmin, Operatoradmin, Policyadmin, UseFT | {}preuser   | Sysadmin                                                                                                         | {}-- 显示当前数据库集簇中目前有哪些表空间
presdb=# \dbList of tablespacesName    |  Owner  |            Location            
------------+---------+--------------------------------pg_default | omm     | pg_global  | omm     | tbs1       | preuser | /opt/gaussdb/install/data/tbs1tbs2       | preuser | /opt/gaussdb/install/data/tbs2
(4 rows)-- \dn 显示当前数据库有哪些数据库模式
presdb=# \dnList of schemasName       | Owner 
-----------------+-------blockchain      | ommcstore          | ommdb4ai           | ommdbe_perf        | ommdbe_pldebugger  | ommdbe_pldeveloper | ommdbe_sql_util    | ommpkg_service     | ommpublic          | ommsnapshot        | ommsqladvisor      | omm
(11 rows)-- \d 显示当前关系列表
presdb=# \dList of relationsSchema |       Name        |   Type   |  Owner  |                    Storage                     
--------+-------------------+----------+---------+------------------------------------------------public | bmsql_config      | table    | preuser | {orientation=row,compression=no}public | bmsql_customer    | table    | preuser | {orientation=row,fillfactor=80,compression=no}public | bmsql_district    | table    | preuser | {orientation=row,fillfactor=80,compression=no}public | bmsql_hist_id_seq | sequence | preuser | public | bmsql_history     | table    | preuser | {orientation=row,fillfactor=80,compression=no}public | bmsql_item        | table    | preuser | {orientation=row,compression=no}public | bmsql_new_order   | table    | preuser | {orientation=row,fillfactor=80,compression=no}public | bmsql_oorder      | table    | preuser | {orientation=row,fillfactor=80,compression=no}public | bmsql_order_line  | table    | preuser | {orientation=row,fillfactor=80,compression=no}public | bmsql_stock       | table    | preuser | {orientation=row,fillfactor=80,compression=no}public | bmsql_warehouse   | table    | preuser | {orientation=row,fillfactor=80,compression=no}
(11 rows)-- \d table_name 显示某个表结构
presdb=# \d bmsql_configTable "public.bmsql_config"Column   |         Type          | Modifiers 
-----------+-----------------------+-----------cfg_name  | character varying(30) | not nullcfg_value | character varying(50) | 
Indexes:"bmsql_config_pkey" PRIMARY KEY, btree (cfg_name) TABLESPACE pg_default
Tablespace: "tbs2"-- \di 显示关系列表
presdb=# \di List of relationsSchema |         Name          | Type  |  Owner  |      Table       | Storage 
--------+-----------------------+-------+---------+------------------+---------public | bmsql_config_pkey     | index | preuser | bmsql_config     | public | bmsql_customer_idx1   | index | preuser | bmsql_customer   | public | bmsql_customer_pkey   | index | preuser | bmsql_customer   | public | bmsql_district_pkey   | index | preuser | bmsql_district   | public | bmsql_history_pkey    | index | preuser | bmsql_history    | public | bmsql_item_pkey       | index | preuser | bmsql_item       | public | bmsql_new_order_pkey  | index | preuser | bmsql_new_order  | public | bmsql_oorder_idx1     | index | preuser | bmsql_oorder     | public | bmsql_oorder_pkey     | index | preuser | bmsql_oorder     | public | bmsql_order_line_pkey | index | preuser | bmsql_order_line | public | bmsql_stock_pkey      | index | preuser | bmsql_stock      | public | bmsql_warehouse_pkey  | index | preuser | bmsql_warehouse  | 
(12 rows)-- \d index_name 显示该索引结构
presdb=# \d bmsql_customer_idx1Index "public.bmsql_customer_idx1"Column  |         Type          | Definition 
---------+-----------------------+------------c_w_id  | integer               | c_w_idc_d_id  | integer               | c_d_idc_last  | character varying(16) | c_lastc_first | character varying(16) | c_first
btree, for table "public.bmsql_customer"

2.4 使用两种方法连到postgres数据库

可以使用gsql -d postgres 或 通过 \c postgres来连接到postres数据库

-- 通过gsql -d postgres来连接到postgres数据库
[omm@opengauss-node1 ~]$ gsql -d postgres -p 26000
gsql ((openGauss 3.1.0 build 4e931f9a) compiled at 2022-09-29 14:19:24 commit 0 last mr  )
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.openGauss=# \q[omm@opengauss-node1 ~]$ gsql -d presdb -p 26000
gsql ((openGauss 3.1.0 build 4e931f9a) compiled at 2022-09-29 14:19:24 commit 0 last mr  )
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.-- 通过 \c postgres 来连接到postgres数据库
presdb=# \c postgres
Non-SSL connection (SSL connection is recommended when requiring high-security)
You are now connected to database "postgres" as user "omm".

image.png

2.5 测试gsql中的默认事务自动提交功能

openGauss在安装时默认是开启了事务自动提交功能,但可以在会话级关闭事务自动提交。

[omm@opengauss-node1 ~]$ gsql -d postgres -p 26000
gsql ((openGauss 3.1.0 build 4e931f9a) compiled at 2022-09-29 14:19:24 commit 0 last mr  )
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.-- 注意 AUTOCOMMIT 一定要大写
openGauss=# show AUTOCOMMIT;  --显示数据库开启了事务自动提交功能autocommit 
------------on
(1 row)openGauss=# \set AUTOCOMMIT off
openGauss=# 
openGauss=# show AUTOCOMMIT;  -- 通过该方式查看到的autocommit仍然是onautocommit 
------------on
(1 row)openGauss=# \echo :AUTOCOMMIT  -- 通过该方式可看到事务提交已关闭
off

image.png

2.5.1 测试事务自动提交

[omm@opengauss-node1 ~]$ gsql -d postgres -p 26000
gsql ((openGauss 3.1.0 build 4e931f9a) compiled at 2022-09-29 14:19:24 commit 0 last mr  )
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.openGauss=# show AUTOCOMMIT;autocommit 
------------on
(1 row)openGauss=# CREATE TABLE customer_t
openGauss-# (  c_customer_sk             integer,   
openGauss(#  c_customer_id             char(5),    
openGauss(#  c_first_name              char(6),    
openGauss(#  c_last_name               char(8) 
openGauss(# ) ;
CREATE TABLE
openGauss=# INSERT INTO customer_t (c_customer_sk, c_customer_id, c_first_name,c_last_name) VALUES (3769, 5, 'Grace','White');
INSERT 0 1
openGauss=# \set AUTOCOMMIT off  -- 关闭事务提交
openGauss=# \echo :AUTOCOMMIT
off
openGauss=# select * from customer_t;  --仍可以查询到之前提交的数据c_customer_sk | c_customer_id | c_first_name | c_last_name 
---------------+---------------+--------------+-------------3769 | 5             | Grace        | White   
(1 row)

image.png

2.5.2 测试事务回滚

[omm@opengauss-node1 ~]$ gsql -d postgres -p 26000
gsql ((openGauss 3.1.0 build 4e931f9a) compiled at 2022-09-29 14:19:24 commit 0 last mr  )
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.openGauss=# select * from customer_t;
ERROR:  relation "customer_t" does not exist on dn_6001_6002
LINE 1: select * from customer_t;^
openGauss=# show AUTOCOMMIT;autocommit 
------------on
(1 row)openGauss=# \echo :AUTOCOMMIT
on
openGauss=# \set AUTOCOMMIT off
openGauss=# \echo :AUTOCOMMIT
off
openGauss=# CREATE TABLE customer_t
openGauss-# (  c_customer_sk             integer,   
openGauss(#  c_customer_id             char(5),    
openGauss(#  c_first_name              char(6),    
openGauss(#  c_last_name               char(8) 
openGauss(# ) ;
CREATE TABLE
openGauss=# INSERT INTO customer_t (c_customer_sk, c_customer_id, c_first_name,c_last_name) VALUES (3769, 5, 'Grace','White');
INSERT 0 1
openGauss=# ROLLBACK;
ROLLBACK
openGauss=# \d customer_t
Did not find any relation named "customer_t".
openGauss=# select * from customer_t;
ERROR:  relation "customer_t" does not exist on dn_6001_6002
LINE 1: select * from customer_t;^
openGauss=# 
# 通过上述实验,当关闭了事务自动提交功能,执行ROLLBACK回滚,是DDL和DML都被回滚了。

image.png

2.6 测试手动事务提交

2.6.1 测试关闭事务自动提交进行手动提交

openGauss=# show AUTOCOMMIT;autocommit 
------------on
(1 row)openGauss=# \echo :AUTOCOMMIT
on
openGauss=# \set AUTOCOMMIT off
openGauss=# \echo :AUTOCOMMIT
off
openGauss=# CREATE TABLE customer_t
openGauss-# (  c_customer_sk             integer,   
openGauss(#  c_customer_id             char(5),    
openGauss(#  c_first_name              char(6),    
openGauss(#  c_last_name               char(8) 
openGauss(# ) ;
CREATE TABLE
openGauss=# INSERT INTO customer_t (c_customer_sk, c_customer_id, c_first_name,c_last_name) VALUES    
openGauss-# (6885, 1, 'Joes', 'Hunter'),    
openGauss-# (4321, 2, 'Lily','Carter'),    
openGauss-# (9527, 3, 'James', 'Cook'),
openGauss-# (9500, 4, 'Lucy', 'Baker');
INSERT 0 4
openGauss=# select * from customer_t;c_customer_sk | c_customer_id | c_first_name | c_last_name 
---------------+---------------+--------------+-------------6885 | 1             | Joes         | Hunter  4321 | 2             | Lily         | Carter  9527 | 3             | James        | Cook    9500 | 4             | Lucy         | Baker   
(4 rows)openGauss=# commit;
COMMIT
openGauss=# select * from customer_t;c_customer_sk | c_customer_id | c_first_name | c_last_name 
---------------+---------------+--------------+-------------6885 | 1             | Joes         | Hunter  4321 | 2             | Lily         | Carter  9527 | 3             | James        | Cook    9500 | 4             | Lucy         | Baker   
(4 rows)openGauss=# rollback;
ROLLBACK
openGauss=# select * from customer_t;c_customer_sk | c_customer_id | c_first_name | c_last_name 
---------------+---------------+--------------+-------------6885 | 1             | Joes         | Hunter  4321 | 2             | Lily         | Carter  9527 | 3             | James        | Cook    9500 | 4             | Lucy         | Baker   
(4 rows)
-- 但关闭了事务自动提交,手动执行了commit,即使之后再执行rollback,提交的事务也不会被回滚。

image.png

2.6.2 测试START TRANSACTION

START TRANSACTION立即启动一个事务,而不管当前的提交模式设置如何。
无论当前的提交模式设置如何,以START transaction开始的事务必须通过发出显式COMMIT或ROLLBACK来结束

[omm@opengauss-node1 ~]$ gsql -d postgres -p 26000
gsql ((openGauss 3.1.0 build 4e931f9a) compiled at 2022-09-29 14:19:24 commit 0 last mr  )
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.openGauss=# show AUTOCOMMIT;autocommit 
------------on
(1 row)openGauss=# \echo :AUTOCOMMIT
on
openGauss=# select * from customer_t;
ERROR:  relation "customer_t" does not exist on dn_6001_6002
LINE 1: select * from customer_t;^
openGauss=# START TRANSACTION;
START TRANSACTION
openGauss=# CREATE TABLE customer_t
openGauss-# (  c_customer_sk             integer,   
openGauss(#  c_customer_id             char(5),    
openGauss(#  c_first_name              char(6),    
openGauss(#  c_last_name               char(8) 
openGauss(# ) ;
CREATE TABLE
openGauss=# INSERT INTO customer_t (c_customer_sk, c_customer_id, c_first_name,c_last_name) VALUES    
openGauss-# (6885, 1, 'Joes', 'Hunter'),    
openGauss-# (4321, 2, 'Lily','Carter'),    
openGauss-# (9527, 3, 'James', 'Cook'),
openGauss-# (9500, 4, 'Lucy', 'Baker');
INSERT 0 4
openGauss=# select * from customer_t;c_customer_sk | c_customer_id | c_first_name | c_last_name 
---------------+---------------+--------------+-------------6885 | 1             | Joes         | Hunter  4321 | 2             | Lily         | Carter  9527 | 3             | James        | Cook    9500 | 4             | Lucy         | Baker   
(4 rows)openGauss=# ROLLBACK;
ROLLBACK
openGauss=# select * from customer_t;
ERROR:  relation "customer_t" does not exist on dn_6001_6002
LINE 1: select * from customer_t;^
-- 通过以上测试,可以看到即使开启了事务自动提交功能,当执行START TRANSACTION,执行rollback,仍然可以回滚当前执行的事务。

image.png

2.7 了解gsql相关帮助

通过gsql --help、-h或-? 可以获取gsql的相关帮助信息

openGauss=# \h
Available help:ABORT                             ALTER SEQUENCE                    COMMIT                            CREATE RESOURCE POOL              DROP APP WORKLOAD GROUP MAPPING   DROP SEQUENCE                     PURGE SNAPSHOTALTER APP WORKLOAD GROUP          ALTER SERVER                      COMMIT PREPARED                   CREATE ROLE                       DROP AUDIT POLICY                 DROP SERVER                       REASSIGN OWNEDALTER APP WORKLOAD GROUP MAPPING  ALTER SESSION                     COPY                              CREATE ROW LEVEL SECURITY POLICY  DROP CLIENT MASTER KEY            DROP SUBSCRIPTION                 REFRESH MATERIALIZED VIEWALTER AUDIT POLICY                ALTER SUBSCRIPTION                CREATE APP WORKLOAD GROUP         CREATE SCHEMA                     DROP COLUMN ENCRYPTION KEY        DROP SYNONYM                      REINDEXALTER DATA SOURCE                 ALTER SYNONYM                     CREATE APP WORKLOAD GROUP MAPPING CREATE SEQUENCE                   DROP DATA SOURCE                  DROP TABLE                        REPLACEALTER DATABASE                    ALTER SYSTEM KILL SESSION         CREATE AUDIT POLICY               CREATE SERVER                     DROP DATABASE                     DROP TABLESPACE                   RESETALTER DEFAULT PRIVILEGES          ALTER SYSTEM SET                  CREATE BARRIER                    CREATE SNAPSHOT AS                DROP DIRECTORY                    DROP TEXT SEARCH CONFIGURATION    REVOKEALTER DIRECTORY                   ALTER TABLE                       CREATE CLIENT MASTER KEY          CREATE SNAPSHOT FROM              DROP EXTENSION                    DROP TEXT SEARCH DICTIONARY       ROLLBACKALTER EXTENSION                   ALTER TABLE PARTITION             CREATE COLUMN ENCRYPTION KEY      CREATE SUBSCRIPTION               DROP FOREIGN TABLE                DROP TRIGGER                      ROLLBACK PREPAREDALTER FOREIGN TABLE               ALTER TABLE SUBPARTITION          CREATE DATA SOURCE                CREATE SYNONYM                    DROP FUNCTION                     DROP TYPE                         SAMPLE SNAPSHOTALTER FOREIGN TABLE FOR HDFS      ALTER TABLESPACE                  CREATE DATABASE                   CREATE TABLE                      DROP GLOBAL CONFIGURATION         DROP USER                         SAVEPOINTALTER FUNCTION                    ALTER TEXT SEARCH CONFIGURATION   CREATE DIRECTORY                  CREATE TABLE AS                   DROP GROUP                        DROP VIEW                         SELECTALTER GLOBAL CONFIGURATION        ALTER TEXT SEARCH DICTIONARY      CREATE EXTENSION                  CREATE TABLE PARTITION            DROP INDEX                        DROP WEAK PASSWORD DICTIONARY     SELECT INTOALTER GROUP                       ALTER TRIGGER                     CREATE FOREIGN TABLE              CREATE TABLE SUBPARTITION         DROP MASKING POLICY               DROP WORKLOAD GROUP               SETALTER INDEX                       ALTER TYPE                        CREATE FUNCTION                   CREATE TABLESPACE                 DROP MATERIALIZED VIEW            END                               SET CONSTRAINTSALTER LARGE OBJECT                ALTER USER                        CREATE GROUP                      CREATE TEXT SEARCH CONFIGURATION  DROP MODEL                        EXECUTE                           SET ROLEALTER MASKING POLICY              ALTER VIEW                        CREATE INDEX                      CREATE TEXT SEARCH DICTIONARY     DROP NODE                         EXECUTE DIRECT                    SET SESSION AUTHORIZATIONALTER MATERIALIZED VIEW           ALTER WORKLOAD GROUP              CREATE LANGUAGE                   CREATE TRIGGER                    DROP NODE GROUP                   EXPLAIN                           SET TRANSACTIONALTER NODE                        ANALYSE                           CREATE MASKING POLICY             CREATE TYPE                       DROP OPERATOR                     FETCH                             SHOWALTER NODE GROUP                  ANALYZE                           CREATE MATERIALIZED VIEW          CREATE USER                       DROP OWNED                        GRANT                             START TRANSACTIONALTER OPERATOR                    ANONYMOUS BLOCK                   CREATE MODEL                      CREATE VIEW                       DROP PACKAGE                      INSERT                            TIMECAPSULE TABLEALTER PACKAGE                     ARCHIVE SNAPSHOT                  CREATE NODE                       CREATE WEAK PASSWORD DICTIONARY   DROP PACKAGE BODY                 LOCK                              TRUNCATEALTER PROCEDURE                   BEGIN                             CREATE NODE GROUP                 CREATE WORKLOAD GROUP             DROP PROCEDURE                    MERGE                             UPDATEALTER PUBLICATION                 CALL                              CREATE OPERATOR                   CURSOR                            DROP PUBLICATION                  MOVE                              VACUUMALTER RESOURCE LABEL              CHECKPOINT                        CREATE PACKAGE                    DEALLOCATE                        DROP RESOURCE LABEL               PREDICT BY                        VALUESALTER RESOURCE POOL               CLEAN CONNECTION                  CREATE PACKAGE BODY               DECLARE                           DROP RESOURCE POOL                PREPARE                           ALTER ROLE                        CLOSE                             CREATE PROCEDURE                  DELETE                            DROP ROLE                         PREPARE TRANSACTION               ALTER ROW LEVEL SECURITY POLICY   CLUSTER                           CREATE PUBLICATION                DO                                DROP ROW LEVEL SECURITY POLICY    PUBLISH SNAPSHOT                  ALTER SCHEMA                      COMMENT                           CREATE RESOURCE LABEL             DROP APP WORKLOAD GROUP           DROP SCHEMA                       PURGE   openGauss=# \?
General\copyright             show openGauss usage and distribution terms\g [FILE] or ;         execute query (and send results to file or |pipe)\h(\help) [NAME]              help on syntax of SQL commands, * for all commands\parallel [on [num]|off] toggle status of execute (currently off)\q                     quit gsqlQuery Buffer\e [FILE] [LINE]       edit the query buffer (or file) with external editor\ef [FUNCNAME [LINE]]  edit function definition with external editor\p                     show the contents of the query buffer\r                     reset (clear) the query buffer\w FILE                write query buffer to fileInput/Output\copy ...              perform SQL COPY with data stream to the client host\echo [STRING]         write string to standard output\i FILE                execute commands from file\i+ FILE KEY           execute commands from encrypted file\ir FILE               as \i, but relative to location of current script\ir+ FILE KEY          as \i+, but relative to location of current script\o [FILE]              send all query results to file or |pipe\qecho [STRING]        write string to query output stream (see \o)Informational(options: S = show system objects, + = additional detail)\d[S+]                 list tables, views, and sequences\d[S+]  NAME           describe table, view, sequence, or index

三、课程总结

通过本课程的学习,加深了对gsql知识的掌握,同时也让我对openGauss的事务提交有了初步的理解。想要更深入的掌握这些知识点,还是要通过不断的测试来充分理解其含义。


http://www.ppmy.cn/embedded/147345.html

相关文章

汽车IVI中控开发入门及进阶(三十八):HiCar开发

手机投屏轻松实现手机与汽车的无缝连接,导航、音乐、通话等功能应有尽有,还支持更多第三方应用,让车载互联生活更加丰富多彩。 HiCar在兼容性和开放性上更具优势。 手机投屏可以说是车机的杀手级应用,大大拓宽了车机的可用性范围。其中华为推出的HiCar就是非常好用的一种。…

vsCode 报错[vue/no-v-model-argument]e‘v-model‘ directives require no argument

在vue3中使用ui库中的组件语法v-model:value时会提示[vue/no-multiple-template-root]The template root requires exactly one element. 引入组件使用单标签时会提示[vue/no-multiple-template-root]“The template root requires exactly one element. 原因: 1.可…

AGM FPGA如何配置上拉或者下拉电阻

AGM FPGA如何配置上拉或者下拉电阻? 1. 如何配置上拉电阻 配置完成之后重新编译,在工程文件下的*,qsf文件中就能发现这样一句话: set instance assignment -name WEAK PULL UP RESISTOR ON -to fm 这句话表明,fm这个引脚已经设置为弱上拉了…

【docker】dockerfile add或者copy的文件 /entrypoint.sh: no such file or directory

dockerfile编写的image启动后找不到启动脚本。 # add add entrypoint.sh / RUN chmod x /entrypoint.sh # 打印下是否已经add或者copy成功 RUN ls -lh /如果报错:no such file or directory 可能是使用了win的换行符,linux系统不识别导致。 如果在ide…

Qt之样式表使用(十一)

Qt开发 系列文章 - stylesheet(十一) 目录 前言 一、样式表stylesheet 二、代码更改 1.特定控件样式 ​编辑 2.类型选择器样式 3.ID选择器样式 三、UI上设计 四、qss文件设计 总结 前言 Qt是一个跨平台的C图形用户界面应用程序开发框架&#…

智慧社区系统源码社区服务软件家政跑腿月嫂保洁维修小程序

应用场景 社区服务软件在现代社区生活中扮演着至关重要的角色,其应用场景涵盖了居民生活的方方面面,主要包括以下几个方面: 家政与生活服务: 家电维修与家庭保洁:居民可以通过软件预约专业的家电维修和家庭保洁服务&a…

Android Vendor Overlay机制

背景介绍: 看Android 15版本更新时,"Android 15 deprecates vendor overlay"。 猜想这个vendor overlay是之前用过的settings overlay, 不过具体是怎么回事呢? 目录 Vendor Overlay介绍 Vendor Overlay工作原理 Ven…

如何有效划分服务器磁盘空间?具体的步骤和流程

有效划分服务器磁盘空间对于提升系统性能、管理方便性和数据安全性至关重要。合理的磁盘分区不仅有助于提高服务器的运行效率,还能在数据恢复、系统故障修复和存储管理方面提供更高的灵活性。以下是如何有效划分服务器磁盘空间的几个关键步骤和注意事项。 磁盘分区的…