Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0441e26

Browse files
committed
Make pltcl create separate function objects when the same function is
used as trigger on different relations. I am not convinced that Tclactually has to have this, but it seems a good idea to make it beparallel to the other PLs that definitely do need it.
1 parent96e6319 commit0441e26

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

‎src/pl/tcl/pltcl.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* ENHANCEMENTS, OR MODIFICATIONS.
3232
*
3333
* IDENTIFICATION
34-
* $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.77 2003/09/04 15:10:10 tgl Exp $
34+
* $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.78 2003/09/14 17:25:54 tgl Exp $
3535
*
3636
**********************************************************************/
3737

@@ -156,7 +156,7 @@ static Datum pltcl_func_handler(PG_FUNCTION_ARGS);
156156

157157
staticHeapTuplepltcl_trigger_handler(PG_FUNCTION_ARGS);
158158

159-
staticpltcl_proc_desc*compile_pltcl_function(Oidfn_oid,boolis_trigger);
159+
staticpltcl_proc_desc*compile_pltcl_function(Oidfn_oid,Oidtgreloid);
160160

161161
staticintpltcl_elog(ClientDatacdata,Tcl_Interp*interp,
162162
intargc,CONST84char*argv[]);
@@ -462,7 +462,7 @@ pltcl_func_handler(PG_FUNCTION_ARGS)
462462
sigjmp_bufsave_restart;
463463

464464
/* Find or compile the function */
465-
prodesc=compile_pltcl_function(fcinfo->flinfo->fn_oid,false);
465+
prodesc=compile_pltcl_function(fcinfo->flinfo->fn_oid,InvalidOid);
466466

467467
if (prodesc->lanpltrusted)
468468
interp=pltcl_safe_interp;
@@ -648,7 +648,8 @@ pltcl_trigger_handler(PG_FUNCTION_ARGS)
648648
sigjmp_bufsave_restart;
649649

650650
/* Find or compile the function */
651-
prodesc=compile_pltcl_function(fcinfo->flinfo->fn_oid, true);
651+
prodesc=compile_pltcl_function(fcinfo->flinfo->fn_oid,
652+
RelationGetRelid(trigdata->tg_relation));
652653

653654
if (prodesc->lanpltrusted)
654655
interp=pltcl_safe_interp;
@@ -956,13 +957,17 @@ pltcl_trigger_handler(PG_FUNCTION_ARGS)
956957

957958
/**********************************************************************
958959
* compile_pltcl_function- compile (or hopefully just look up) function
960+
*
961+
* tgreloid is the OID of the relation when compiling a trigger, or zero
962+
* (InvalidOid) when compiling a plain function.
959963
**********************************************************************/
960964
staticpltcl_proc_desc*
961-
compile_pltcl_function(Oidfn_oid,boolis_trigger)
965+
compile_pltcl_function(Oidfn_oid,Oidtgreloid)
962966
{
967+
boolis_trigger=OidIsValid(tgreloid);
963968
HeapTupleprocTup;
964969
Form_pg_procprocStruct;
965-
charinternal_proname[64];
970+
charinternal_proname[128];
966971
Tcl_HashEntry*hashent;
967972
pltcl_proc_desc*prodesc=NULL;
968973
Tcl_Interp*interp;
@@ -986,7 +991,7 @@ compile_pltcl_function(Oid fn_oid, bool is_trigger)
986991
"__PLTcl_proc_%u",fn_oid);
987992
else
988993
snprintf(internal_proname,sizeof(internal_proname),
989-
"__PLTcl_proc_%u_trigger",fn_oid);
994+
"__PLTcl_proc_%u_trigger_%u",fn_oid,tgreloid);
990995

991996
/************************************************************
992997
* Lookup the internal proc name in the hashtable

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp