If I need to determine if a given table is a view, can I do this with a query instead of using '\d' ? I have a script that needs to audit several tables for deletion but don't want to check them all manually.
You can find that information from the information_schema.tables view:
select table_type
from information_schema.tables
where table_schema = 'my_schema' and table_name = 'my_table'
table_type
column description:
Type of the table: BASE TABLE for a persistent base table (the normal table type), VIEW for a view, FOREIGN TABLE for a foreign table, or LOCAL TEMPORARY for a temporary table
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With