Skip site navigation (1) Skip section navigation (2)

Check if table or View exists

From: "Jeff Williams" <jeff(dot)williams(at)hardsoft(dot)com(dot)au>
To: pgsql-general(at)postgresql(dot)org
Subject: Check if table or View exists
Date: 2008-04-01 01:35:01
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general
I am developing an application where I will have a default table and/or
view for a select statement for my application.  If a client has a special
requirement I would like to have a alternate table of the same name in a
different schema with the change structure.

Schema A
   Default table -

Schema B
   Client specific table

How can I check if a table or alternate view exists in schema B.


if exists // check for a view or table
  // my code will use table
  // my code will use

Also is it possible to check via function/via in postgress and not have to
rely on my application to do the check.  If so how.

In response to


pgsql-general by date

Next:From: Jorge GodoyDate: 2008-04-01 03:13:42
Subject: Re: Check if table or View exists
Previous:From: Clemens SchwaighoferDate: 2008-04-01 01:11:33
Subject: Re: Survey: renaming/removing script binaries (createdb, createuser...)

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group