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/
Index: src/backend/commands/proclang.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/commands/proclang.c,v
retrieving revision 1.87
diff -r1.87 proclang.c
84,86c84,94
< 		ereport(ERROR,
< 				(errcode(ERRCODE_DUPLICATE_OBJECT),
< 				 errmsg("language \"%s\" already exists", languageName)));
---
> 		if (!stmt->replace)
> 			ereport(ERROR,
> 					(errcode(ERRCODE_DUPLICATE_OBJECT),
> 					 errmsg("language \"%s\" already exists", languageName)));
> 		else
> 		{
> 			ereport(NOTICE,
> 					(errmsg("language \"%s\" already exists, skipping", languageName)));
> 			return;
> 		}
> 
Index: src/backend/parser/gram.y
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/parser/gram.y,v
retrieving revision 2.679
diff -r2.679 gram.y
2768c2768
< 			CREATE opt_trusted opt_procedural LANGUAGE ColId_or_Sconst
---
> 			CREATE opt_or_replace opt_trusted opt_procedural LANGUAGE ColId_or_Sconst
2771c2771,2772
< 				n->plname = $5;
---
> 				n->replace = $2;
> 				n->plname = $6;
2779c2780
< 			| CREATE opt_trusted opt_procedural LANGUAGE ColId_or_Sconst
---
> 			| CREATE opt_or_replace opt_trusted opt_procedural LANGUAGE ColId_or_Sconst
2783,2787c2784,2789
< 				n->plname = $5;
< 				n->plhandler = $7;
< 				n->plinline = $8;
< 				n->plvalidator = $9;
< 				n->pltrusted = $2;
---
> 				n->replace = $2;
> 				n->plname = $6;
> 				n->plhandler = $8;
> 				n->plinline = $9;
> 				n->plvalidator = $10;
> 				n->pltrusted = $3;
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 */
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to