How to check table is exist?
HyeontaeJu
Vertica Customer ✭
How to check the table is exist not using 'tables' table?
0
Answers
What's wrong with using V_CATALOG.TABLES or V_CATALOG.ALL_TABLES? Are you against using other system tables (i.e. V_CATALOG.COLUMNS)?
Other options ... You can use the vsql meta functions \d or \dt
Or try exporting the table:
If you want to check if a table (or a column) exists avoid errors when trying to DROP or ALTER it, there's also the IF EXISTS syntax.
DROP TABLE IF EXISTS foo;
In addition, to create an alias that accepts one or more arguments, we can use bash functions.
Just type the following 4 lines in bash, with an Enter at the end.
Usage examples:
1) To find all tables name which include charecters “t2”, type: vfind t2
2) To find all tables name which include charecters “proj”, type: vfind proj
3) To print a complete listing of all tables and views in your DB, type only: vfind
(Without any variables)