query to find whether an object is table or view in postgresql

Postgresql has a default schema named information_schema, which consists of a set of views, that contain information about the objects defined in the current database.

Query:

select * from information_schema.tables where table_name like ‘%<object name>%’;

tables: This view contains all tables and views defined in the current database.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: