Re: Please clarify

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: palanivel(dot)kumaran(at)scandent(dot)com
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Please clarify
Date: 2005-05-10 18:24:30
Message-ID: Pine.OSF.4.61.0505102119450.368341@kosh.hut.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, 10 May 2005 palanivel(dot)kumaran(at)scandent(dot)com wrote:

> I need to check for the existence of a user defined view named 'audit_vw'
> and if exists, then i need to delete the same. Please help me to solve the
> issue.

If you don't need to do anything else in the transaction, you could just
issue "DROP VIEW audit_vw" and see if it succeeds or fails.

If you do need to do something else in the same transaction, you can use
savepoints:

BEGIN;
SAVEPOINT sp;
DROP VIEW audit_vw;
if it fails: ROLLBACK TO sp;
...
COMMIT;

Ps. This kind of questions are usually discussed on the pgsql-general
mailing list.

- Heikki

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Merlin Moncure 2005-05-10 18:28:18 FW: Views, views, views! (long)
Previous Message Jim C. Nasby 2005-05-10 18:07:01 Re: Oracle Style packages on postgres