Please clarify

Started by Nonameover 20 years ago3 messages
#1Noname
palanivel.kumaran@scandent.com

Hai,

I need a clarification for the below:

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.

Thanks & Regards
Palanivel P.K

Important Email Information :- The information in this email is
confidential and may be legally privileged. It is intended solely for
the addressee. Access to this email by anyone else is unauthorized. If
you are not the intended recipient, any disclosure, copying, distribution or
any action taken or omitted to be taken in reliance on it, is prohibited
and may be unlawful. If you are not the intended addressee please contact
the sender and dispose of this e-mail immediately.

#2Christopher Kings-Lynne
chriskl@familyhealth.com.au
In reply to: Noname (#1)
Re: Please clarify

Try selecting from pg_views to see if it exists, then if it does, drop it.

Chris

palanivel.kumaran@scandent.com wrote:

Show quoted text

Hai,

I need a clarification for the below:

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.

Thanks & Regards
Palanivel P.K

Important Email Information :- The information in this email is
confidential and may be legally privileged. It is intended solely for
the addressee. Access to this email by anyone else is unauthorized. If
you are not the intended recipient, any disclosure, copying, distribution or
any action taken or omitted to be taken in reliance on it, is prohibited
and may be unlawful. If you are not the intended addressee please contact
the sender and dispose of this e-mail immediately.

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

#3Heikki Linnakangas
hlinnaka@iki.fi
In reply to: Noname (#1)
Re: Please clarify

On Tue, 10 May 2005 palanivel.kumaran@scandent.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