Menu

Checking Whether a GBase 8a View Still References Valid Tables
📰

Checking Whether a GBase 8a View Still References Valid Tables

DEV Community: sql·Michael·4 days ago
#7aNg7tZg
#devtosql#devto#dev#table#gbase
Long article (383 words) — no AI summary yet.
Reading 0:00
15s threshold

GBase 8a supports views. When a view is created, every table or other view it references must exist; if one of them is dropped later, querying the view fails. The China-domestically developed GBase 8a MPP database from GBASE provides check table to verify whether a view's references are still valid.

Syntax

check table [ vc . ] [ db . ] VIEW_NAME

Enter fullscreen mode

Exit fullscreen mode

Example

The sample below creates a view, drops the table behind it, and compares the check table output before and after:

gbase> create table a(id int); Query OK, 0 rows affected (Elapsed: 00:00:00.07)

gbase> insert into a values(8); Query OK, 1 row affected (Elapsed: 00:00:00.07)

gbase> select * from a; +------+ | id | +------+ | 8 | +------+ 1 row in set (Elapsed: 00:00:00.02)

gbase> create view v_a as select * from a; Query OK, 0 rows affected (Elapsed: 00:00:00.06)

gbase> select * from v_a; +------+ | id | +------+ | 8 | +------+ 1 row in set (Elapsed: 00:00:00.02)

gbase> check table v_a;…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.