云数据库 GAUSSDB-查看系统表:查看数据库中包含的表

时间:2024-11-02 18:47:34

查看数据库中包含的表

在public Schema下新建五张表:
openGauss=#  CREATE TABLE public.search_table_t1(a int) distribute by hash(a);
CREATE TABLE
openGauss=#  CREATE TABLE public.search_table_t2(b int) distribute by hash(b);
CREATE TABLE
openGauss=#  CREATE TABLE public.search_table_t3(c int) distribute by hash(c);
CREATE TABLE
openGauss=#  CREATE TABLE public.search_table_t4(d int) distribute by hash(d);
CREATE TABLE
openGauss=#  CREATE TABLE public.search_table_t5(e int) distribute by hash(e);
CREATE TABLE
在PG_TABLES系统表中查看public Schema中包含的前缀为search_table的表。
1
openGauss=# SELECT distinct(tablename) FROM pg_tables WHERE SCHEMANAME = 'public' AND TABLENAME LIKE 'search_table%';

结果类似如下这样:

1
2
3
4
5
6
7
8
    tablename
-----------------
 search_table_t1
 search_table_t2
 search_table_t3
 search_table_t4
 search_table_t5
(5 rows)
support.huaweicloud.com/distributed-devg-v2-gaussdb/gaussdb-12-0033.html