X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 35D9C5352D for ; Wed, 6 Apr 2005 21:03:38 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 80463-02 for ; Wed, 6 Apr 2005 20:03:28 +0000 (GMT) Received: from priv-edtnes51.telusplanet.net (outbound04.telus.net [199.185.220.223]) by svr1.postgresql.org (Postfix) with ESMTP id B7A3952A45 for ; Wed, 6 Apr 2005 21:03:26 +0100 (BST) Received: from localhost ([199.185.220.240]) by priv-edtnes51.telusplanet.net (InterMail vM.6.01.04.00 201-2131-118-20041027) with ESMTP id <20050406200328.ZLJA11292.priv-edtnes51.telusplanet.net@localhost>; Wed, 6 Apr 2005 14:03:28 -0600 Received: from 209.17.183.249 ( [209.17.183.249]) as user a3a18850@204.209.205.53 by webmail.telus.net with HTTP; Wed, 6 Apr 2005 13:03:27 -0700 Message-ID: <1112817807.4254408fecadc@webmail.telus.net> Date: Wed, 6 Apr 2005 13:03:27 -0700 From: Mischa To: Philippe Lang Cc: pgsql-sql@postgresql.org Subject: Re: DROP TYPE without error? References: <6C0CF58A187DA5479245E0830AF84F4208057C@poweredge.attiksystem.ch> In-Reply-To: <6C0CF58A187DA5479245E0830AF84F4208057C@poweredge.attiksystem.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.1-cvs X-Originating-IP: 209.17.183.249 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.082 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_POST, FORGED_RCVD_HELO X-Spam-Level: * X-Archive-Number: 200504/61 X-Sequence-Number: 20954 Quoting Philippe Lang : > 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."