pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mischa <mischa.Sandberg@telus.net>
To: Philippe Lang <philippe.lang@attiksystem.ch>
Cc: pgsql-sql@postgresql.org
Subject: Re: DROP TYPE without error?
Date: Wed,  6 Apr 2005 13:03:27 -0700
Message-ID: <1112817807.4254408fecadc@webmail.telus.net> (raw)
In-Reply-To: <6C0CF58A187DA5479245E0830AF84F4208057C@poweredge.attiksystem.ch>
References: <6C0CF58A187DA5479245E0830AF84F4208057C@poweredge.attiksystem.ch>

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."




view thread (5+ messages)  latest in thread

Message-ID: <1112817807.4254408fecadc@webmail.telus.net>
Permalink:  ../1112817807.4254408fecadc@webmail.telus.net/
Also on:    postgresql.org/message-id/1112817807.4254408fecadc@webmail.telus.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: mischa.Sandberg@telus.net, philippe.lang@attiksystem.ch
  Subject: Re: DROP TYPE without error?
  In-Reply-To: <1112817807.4254408fecadc@webmail.telus.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox