1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-02 04:21:28 +03:00

Apply the core parts of Dennis Bjorklund's patch to allow function

parameters to be declared with names.  pg_proc has a column to store
names, and CREATE FUNCTION can insert data into it, but that's all as
yet.  I need to do more work on the pg_dump and plpgsql portions of the
patch before committing those, but I thought I'd get the bulky changes
in before the tree drifts under me.
initdb forced due to pg_proc change.
This commit is contained in:
Tom Lane
2004-01-06 23:55:19 +00:00
parent 488f2785d0
commit a77e32d7c5
20 changed files with 1841 additions and 1650 deletions

View File

@@ -33,7 +33,7 @@
* ENHANCEMENTS, OR MODIFICATIONS.
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.41 2003/11/29 19:52:12 pgsql Exp $
* $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.42 2004/01/06 23:55:19 tgl Exp $
*
**********************************************************************/
@@ -569,6 +569,8 @@ compile_plperl_function(Oid fn_oid, bool is_trigger)
HeapTuple typeTup;
Form_pg_language langStruct;
Form_pg_type typeStruct;
Datum prosrcdatum;
bool isnull;
char *proc_source;
/************************************************************
@@ -707,8 +709,12 @@ compile_plperl_function(Oid fn_oid, bool is_trigger)
* through the reference.
*
************************************************************/
prosrcdatum = SysCacheGetAttr(PROCOID, procTup,
Anum_pg_proc_prosrc, &isnull);
if (isnull)
elog(ERROR, "null prosrc");
proc_source = DatumGetCString(DirectFunctionCall1(textout,
PointerGetDatum(&procStruct->prosrc)));
prosrcdatum));
/************************************************************
* Create the procedure in the interpreter

View File

@@ -3,7 +3,7 @@
* procedural language
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.70 2003/11/29 19:52:12 pgsql Exp $
* $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.71 2004/01/06 23:55:19 tgl Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
@@ -235,6 +235,8 @@ do_compile(FunctionCallInfo fcinfo,
Form_pg_proc procStruct = (Form_pg_proc) GETSTRUCT(procTup);
int functype = CALLED_AS_TRIGGER(fcinfo) ? T_TRIGGER : T_FUNCTION;
PLpgSQL_function *function;
Datum prosrcdatum;
bool isnull;
char *proc_source;
HeapTuple typeTup;
Form_pg_type typeStruct;
@@ -252,8 +254,11 @@ do_compile(FunctionCallInfo fcinfo,
* function cannot be invoked recursively, so there's no need to save
* and restore the static variables used here.
*/
proc_source = DatumGetCString(DirectFunctionCall1(textout,
PointerGetDatum(&procStruct->prosrc)));
prosrcdatum = SysCacheGetAttr(PROCOID, procTup,
Anum_pg_proc_prosrc, &isnull);
if (isnull)
elog(ERROR, "null prosrc");
proc_source = DatumGetCString(DirectFunctionCall1(textout, prosrcdatum));
plpgsql_scanner_init(proc_source, functype);
pfree(proc_source);

View File

@@ -29,7 +29,7 @@
* MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.43 2004/01/04 00:14:17 momjian Exp $
* $PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.44 2004/01/06 23:55:19 tgl Exp $
*
*********************************************************************
*/
@@ -1032,7 +1032,8 @@ PLy_procedure_create(FunctionCallInfo fcinfo, Oid tgreloid,
Form_pg_proc procStruct;
PLyProcedure *volatile proc;
char *volatile procSource = NULL;
Datum procDatum;
Datum prosrcdatum;
bool isnull;
int i,
rv;
@@ -1153,9 +1154,12 @@ PLy_procedure_create(FunctionCallInfo fcinfo, Oid tgreloid,
/*
* get the text of the function.
*/
procDatum = DirectFunctionCall1(textout,
PointerGetDatum(&procStruct->prosrc));
procSource = DatumGetCString(procDatum);
prosrcdatum = SysCacheGetAttr(PROCOID, procTup,
Anum_pg_proc_prosrc, &isnull);
if (isnull)
elog(ERROR, "null prosrc");
procSource = DatumGetCString(DirectFunctionCall1(textout,
prosrcdatum));
PLy_procedure_compile(proc, procSource);

View File

@@ -31,7 +31,7 @@
* ENHANCEMENTS, OR MODIFICATIONS.
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/pl/tcl/pltcl.c,v 1.80 2003/11/29 19:52:13 pgsql Exp $
* $PostgreSQL: pgsql/src/pl/tcl/pltcl.c,v 1.81 2004/01/06 23:55:19 tgl Exp $
*
**********************************************************************/
@@ -1036,6 +1036,8 @@ compile_pltcl_function(Oid fn_oid, Oid tgreloid)
Tcl_DString proc_internal_def;
Tcl_DString proc_internal_body;
char proc_internal_args[4096];
Datum prosrcdatum;
bool isnull;
char *proc_source;
char buf[512];
@@ -1244,8 +1246,12 @@ compile_pltcl_function(Oid fn_oid, Oid tgreloid)
/************************************************************
* Add user's function definition to proc body
************************************************************/
prosrcdatum = SysCacheGetAttr(PROCOID, procTup,
Anum_pg_proc_prosrc, &isnull);
if (isnull)
elog(ERROR, "null prosrc");
proc_source = DatumGetCString(DirectFunctionCall1(textout,
PointerGetDatum(&procStruct->prosrc)));
prosrcdatum));
UTF_BEGIN;
Tcl_DStringAppend(&proc_internal_body, UTF_E2U(proc_source), -1);
UTF_END;