Re: create language ... if not exists

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>, "Andreas 'ads' Scherbaum" <adsmail(at)wars-nicht(dot)de>, pgsql-patches(at)postgresql(dot)org
Subject: Re: create language ... if not exists
Date: 2008-03-29 16:35:36
Message-ID: 9103.1206808536@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
> Heikki Linnakangas wrote:
>> The way we've solved this problem for other CREATE commands is to add
>> "OR REPLACE" option, instead of "IF NOT EXISTS". We should do the same
>> here.

> My recollection is that we only do that where we need to for reasons of
> dependency. Not sure that applies here.

I was about to make the same complaint as Heikki. We currently have two
different ways of dealing with this type of scenario:
DROP IF EXISTS (for most object types)
CREATE OR REPLACE (for functions, rules, views)
The OP wants to introduce yet a third variant, implemented for only one
kind of object. That's not a feature, it's a wart.

Clearly DROP IF EXISTS isn't helpful for the proposed use-case (since
you'd lose any pre-existing functions in the language) but I don't see
why CREATE OR REPLACE wouldn't serve.

regards, tom lane

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2008-03-29 17:25:20 Re: create language ... if not exists
Previous Message Tom Lane 2008-03-29 16:19:53 Re: [PATCHES] Implemented current_query