Re: drop if exists

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
Cc: pgman(at)candle(dot)pha(dot)pa(dot)us, tgl(at)sss(dot)pgh(dot)pa(dot)us, pgsql-patches(at)postgresql(dot)org
Subject: Re: drop if exists
Date: 2005-11-17 14:04:42
Message-ID: 437C8DFA.3080104@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Christopher Kings-Lynne wrote:

>> I think anything else will have to be done individually, although the
>> pattern can be copied.
>>
>> Perhaps we should take bids on what should/should not be covered.
>
>
> Everything should be covered, otherwise it's just annoying for users...

Well, that's arguably more than I originally signed up for ;-) See

http://archives.postgresql.org/pgsql-hackers/2005-10/msg00632.php

There are currently DROP commends for the following 21 objects
(according to the docs).

AGGREGATE
CAST
CONVERSION
DATABASE
DOMAIN
FUNCTION
GROUP
INDEX
LANGUAGE
OPERATOR
OPERATOR CLASS
ROLE
RULE
SCHEMA
SEQUENCE
TABLE
TABLESPACE
TRIGGER
TYPE
USER
VIEW

If the consensus is to add this to all of them, then I propose to apply
the patch I have (with a slight fix for an oversight in the case of
domains, plus docs and tests) for the 8 cases and start working on the
remaining 13 as time permits. To be honest, I have not even looked at
those 13 cases.

One motivation for this, besides general utility, is to ease MySQL
migrations, btw, and AFAICT they only have three DROP commands and only
two of them (TABLE and DATABASE) have IF EXISTS - DROP INDEX does not
for some reason - probably because it is actually mapped to an ALTER
TABLE statement.

cheers

andrew

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2005-11-17 14:26:14 Re: Numeric 508 datatype
Previous Message Martijn van Oosterhout 2005-11-17 13:49:00 [PATCH] Formatting patch for psql