Thread: Patch: create or replace language

Patch: create or replace language

From
Andreas 'ads' Scherbaum
Date:
Hello,

following this old discussion:

http://archives.postgresql.org/pgsql-patches/2008-03/msg00402.php

i modifies the patch to use the "CREATE [OR REPLACE] LANGUAGE" syntax.
If the patch is ok, i will add the documentation too.


Kind regards

--
                Andreas 'ads' Scherbaum
German PostgreSQL User Group
European PostgreSQL User Group - Board of Directors
Volunteer Regional Contact, Germany - PostgreSQL Project

PGDay.eu 2009 in Paris, Nov. 6/7, http://www.pgday.eu/

Attachment

Re: Patch: create or replace language

From
Tom Lane
Date:
"Andreas 'ads' Scherbaum" <adsmail@wars-nicht.de> writes:
> following this old discussion:
> http://archives.postgresql.org/pgsql-patches/2008-03/msg00402.php
> i modifies the patch to use the "CREATE [OR REPLACE] LANGUAGE" syntax.

This is not an "OR REPLACE" operation, because it doesn't replace
the existing definition.  What you've got here is a CREATE IF NOT EXISTS
implementation that arbitrarily uses the other syntax.  The point of
the previous discussion was summed up here:
http://archives.postgresql.org/pgsql-patches/2008-03/msg00416.php
namely that CREATE OR REPLACE should leave the object having the
properties specified in the command.
        regards, tom lane


Re: Patch: create or replace language

From
Alvaro Herrera
Date:
Andreas 'ads' Scherbaum wrote:
> 
> Hello,
> 
> following this old discussion:
> 
> http://archives.postgresql.org/pgsql-patches/2008-03/msg00402.php
> 
> i modifies the patch to use the "CREATE [OR REPLACE] LANGUAGE" syntax.
> If the patch is ok, i will add the documentation too.

Please send a context diff (however much ED IS THE STANDARD!!! TEXT
EDITOR, we don't like its patches here).  Note that you probably missed
updates to other functions touching the node to which you add the
boolean.  Also, per Tom's followup,

> Index: src/include/nodes/parsenodes.h
> ===================================================================
> RCS file: /projects/cvsroot/pgsql/src/include/nodes/parsenodes.h,v
> retrieving revision 1.402
> diff -r1.402 parsenodes.h
> 1570a1571
> >     bool        replace;        /* T => replace if already exists */

this comment needs fixed.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.


Re: Patch: create or replace language

From
Robert Haas
Date:
On Tue, Oct 6, 2009 at 10:24 AM, Alvaro Herrera
<alvherre@commandprompt.com> wrote:
> Andreas 'ads' Scherbaum wrote:
>>
>> Hello,
>>
>> following this old discussion:
>>
>> http://archives.postgresql.org/pgsql-patches/2008-03/msg00402.php
>>
>> i modifies the patch to use the "CREATE [OR REPLACE] LANGUAGE" syntax.
>> If the patch is ok, i will add the documentation too.
>
> Please send a context diff (however much ED IS THE STANDARD!!! TEXT
> EDITOR, we don't like its patches here).  Note that you probably missed
> updates to other functions touching the node to which you add the
> boolean.  Also, per Tom's followup,
>
>> Index: src/include/nodes/parsenodes.h
>> ===================================================================
>> RCS file: /projects/cvsroot/pgsql/src/include/nodes/parsenodes.h,v
>> retrieving revision 1.402
>> diff -r1.402 parsenodes.h
>> 1570a1571
>> >     bool            replace;                /* T => replace if already exists */
>
> this comment needs fixed.

Maybe I'm out of line to say this, but it seems to me that we should
not even be looking at newly-submitted patches at this point.

...Robert


Re: Patch: create or replace language

From
Alvaro Herrera
Date:
Robert Haas escribió:
> On Tue, Oct 6, 2009 at 10:24 AM, Alvaro Herrera
> <alvherre@commandprompt.com> wrote:

> > this comment needs fixed.
> 
> Maybe I'm out of line to say this, but it seems to me that we should
> not even be looking at newly-submitted patches at this point.

Yeah, it was so short I didn't see any point in not commenting.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.


Re: Patch: create or replace language

From
Tom Lane
Date:
Robert Haas <robertmhaas@gmail.com> writes:
> Maybe I'm out of line to say this, but it seems to me that we should
> not even be looking at newly-submitted patches at this point.

It would have been more work to put it in the queue to reject later
than to reject it now ;-).  Besides, this way Andreas has a chance
to rewrite it into something acceptable before the next CF.
        regards, tom lane


Re: Patch: create or replace language

From
Robert Haas
Date:
On Tue, Oct 6, 2009 at 10:48 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Robert Haas <robertmhaas@gmail.com> writes:
>> Maybe I'm out of line to say this, but it seems to me that we should
>> not even be looking at newly-submitted patches at this point.
>
> It would have been more work to put it in the queue to reject later
> than to reject it now ;-).  Besides, this way Andreas has a chance
> to rewrite it into something acceptable before the next CF.

Fair enough.

...Robert


Re: Patch: create or replace language

From
Bernd Helmle
Date:

--On 6. Oktober 2009 10:13:54 -0400 Tom Lane <tgl@sss.pgh.pa.us> wrote:

> http://archives.postgresql.org/pgsql-patches/2008-03/msg00416.php
> namely that CREATE OR REPLACE should leave the object having the
> properties specified in the command.

Maybe when implementing this, it can be worth to keep an eye on ALTER 
LANGUAGE too ?

-- 
Thanks
Bernd