Skip site navigation (1) Skip section navigation (2)

Re: create language ... if not exists

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, 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 21:32:39
Message-ID: 20080329223239.31c69ab3@mha-laptop (view raw, whole thread or download thread mbox)
Lists: pgsql-patches
Heikki Linnakangas wrote:
> Tom Lane wrote:
> > Heikki Linnakangas <heikki(at)enterprisedb(dot)com> writes:
> >> 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.
> > 
> > If we're willing to consider a solution that is specific to CREATE
> > LANGUAGE (as opposed to implementing IF NOT EXISTS across-the-board,
> > which might happen someday) what I'd suggest is just incorporating
> > the behavior directly into the abbreviated (no parameters) form of
> > CREATE LANGUAGE.  If the language already exists and has the same
> > properties specified in pg_pltemplate, don't raise an error.  Give
> > a notice maybe.
> Why not implement "OR REPLACE" like for other things? Still seems the 
> most consistent behavior to me.
> You might want to get the error if the language already exists, which 
> your proposal wouldn't allow. And it wouldn't help with languages 
> without a pg_pltemplate entry.

Even though I was the guy originally suggesting that Andreas put
forward a patch for IF NOT EXISTS, now that it's being mention I agree
with Heikki - it's more consistent. And I see the primary use as being
in installation scripts for software that requires pl/pgsql (or any
other PL), for which the exact syntax really doesn't matter - it's
better to be consistent.

If we're implementing IF NOT EXISTS across the board, let's do that for
languages at the same time as for others.


In response to


pgsql-patches by date

Next:From: Tom LaneDate: 2008-03-29 21:39:57
Subject: Re: create language ... if not exists
Previous:From: Tom LaneDate: 2008-03-29 19:23:14
Subject: Re: Better psql tab-completion support for schemas and tables

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group