Re: DROP TYPE without error? - Mailing list pgsql-sql

From Mischa
Subject Re: DROP TYPE without error?
Date
Msg-id 1112817807.4254408fecadc@webmail.telus.net
Whole thread Raw
In response to DROP TYPE without error?  ("Philippe Lang" <philippe.lang@attiksystem.ch>)
List pgsql-sql
Quoting Philippe Lang <philippe.lang@attiksystem.ch>:

> Since it is not possible to use CREATE OR REPLACE TYPE, is there a way
> of using DROP TYPE on a non-existing type, without causing the entire
> script to abort? It may sound crazy to ask for this, but it could be
> really useful in my case, where Pl/Pgsql and Pl/Perl code is being
> generated automatically, based on data found in a database.

I've got a similar request for other objects that do/do not exist.
Maybe it's just that I got lazy using MSSQL, but it sure was convenient
to have:
  IF object_id('WorkTable') IS NULL      CREATE TABLE WorkTable(...
etc.

Given that you cannot just execute an anonymous block of PL/PGSQL code,
where you could do the test AND the create ...

-- 
"Dreams come true, not free."



pgsql-sql by date:

Previous
From: "Dinesh Pandey"
Date:
Subject: FW: createlang 'pltclu' with postgreSQL.
Next
From: Tom Lane
Date:
Subject: Re: [GENERAL] Problems with Set Returning Functions (SRFs)