Re: Built-in functions - does an obect exist...
От | Bruno Wolff III |
---|---|
Тема | Re: Built-in functions - does an obect exist... |
Дата | |
Msg-id | 20040608194245.GA15498@wolff.to обсуждение исходный текст |
Ответ на | Built-in functions - does an obect exist... ("Loftis, Charles E" <charles.loftis@eds.com>) |
Список | pgsql-novice |
On Tue, Jun 08, 2004 at 14:08:11 -0500, "Loftis, Charles E" <charles.loftis@eds.com> wrote: > In many other db systems you can use built in functions to check to see if > an object exists in the db... > > For example, in Sybase, you can use the object_id function to check to see > if an object exists... > if object_id('some table, view, stored procedure, etc. name') is not null > -- perform some action, like drop a stored proc > else > -- perform some other action > End -- if > > > Does an equivalent function exist in Postgres? > Furthermore, where should I look to find the list of such built-in > functions? The system catalog and the information schema have metadata about objects. You can query those tables to find out if an object with a particular name currently exists. The logic for what to do depending on what is found will probably need to be in your application or in a function. Straight SQL is pretty limited for providing conditional code execution.
В списке pgsql-novice по дате отправления: