|
3 | 3 | * procedural language
|
4 | 4 | *
|
5 | 5 | * IDENTIFICATION
|
6 |
| - * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.45 2001/07/11 18:54:18 momjian Exp $ |
| 6 | + * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.46 2001/07/12 17:42:07 momjian Exp $ |
7 | 7 | *
|
8 | 8 | * This software is copyrighted by Jan Wieck - Hamburg.
|
9 | 9 | *
|
|
47 | 47 | #include"plpgsql.h"
|
48 | 48 | #include"pl.tab.h"
|
49 | 49 |
|
50 |
| -#include"miscadmin.h" |
51 | 50 | #include"access/heapam.h"
|
52 | 51 | #include"catalog/pg_proc.h"
|
53 | 52 | #include"catalog/pg_type.h"
|
@@ -106,8 +105,6 @@ static int exec_stmt_exit(PLpgSQL_execstate * estate,
|
106 | 105 | PLpgSQL_stmt_exit*stmt);
|
107 | 106 | staticintexec_stmt_return(PLpgSQL_execstate*estate,
|
108 | 107 | PLpgSQL_stmt_return*stmt);
|
109 |
| -staticintexec_stmt_setauth(PLpgSQL_execstate*estate, |
110 |
| -PLpgSQL_stmt_setauth*stmt); |
111 | 108 | staticintexec_stmt_raise(PLpgSQL_execstate*estate,
|
112 | 109 | PLpgSQL_stmt_raise*stmt);
|
113 | 110 | staticintexec_stmt_execsql(PLpgSQL_execstate*estate,
|
@@ -229,9 +226,6 @@ plpgsql_exec_function(PLpgSQL_function * func, FunctionCallInfo fcinfo)
|
229 | 226 | casePLPGSQL_STMT_RETURN:
|
230 | 227 | stmttype="return";
|
231 | 228 | break;
|
232 |
| -casePLPGSQL_STMT_SETAUTH: |
233 |
| -stmttype="setauth"; |
234 |
| -break; |
235 | 229 | casePLPGSQL_STMT_RAISE:
|
236 | 230 | stmttype="raise";
|
237 | 231 | break;
|
@@ -283,10 +277,7 @@ plpgsql_exec_function(PLpgSQL_function * func, FunctionCallInfo fcinfo)
|
283 | 277 | estate.retistuple=func->fn_retistuple;
|
284 | 278 | estate.retisset=func->fn_retset;
|
285 | 279 | estate.exitlabel=NULL;
|
286 |
| -estate.invoker_uid=GetUserId(); |
287 |
| -estate.definer_uid=func->definer_uid; |
288 |
| -estate.auth_level=PLPGSQL_AUTH_INVOKER; |
289 |
| - |
| 280 | + |
290 | 281 | estate.found_varno=func->found_varno;
|
291 | 282 | estate.ndatums=func->ndatums;
|
292 | 283 | estate.datums=palloc(sizeof(PLpgSQL_datum*)*estate.ndatums);
|
@@ -406,9 +397,6 @@ plpgsql_exec_function(PLpgSQL_function * func, FunctionCallInfo fcinfo)
|
406 | 397 | elog(ERROR,"control reaches end of function without RETURN");
|
407 | 398 | }
|
408 | 399 |
|
409 |
| -if (estate.auth_level!=PLPGSQL_AUTH_INVOKER) |
410 |
| -SetUserId(estate.invoker_uid); |
411 |
| - |
412 | 400 | /*
|
413 | 401 | * We got a return value - process it
|
414 | 402 | */
|
@@ -589,9 +577,6 @@ plpgsql_exec_trigger(PLpgSQL_function * func,
|
589 | 577 | estate.retistuple=func->fn_retistuple;
|
590 | 578 | estate.retisset=func->fn_retset;
|
591 | 579 | estate.exitlabel=NULL;
|
592 |
| -estate.invoker_uid=GetUserId(); |
593 |
| -estate.definer_uid=func->definer_uid; |
594 |
| -estate.auth_level=PLPGSQL_AUTH_INVOKER; |
595 | 580 |
|
596 | 581 | estate.found_varno=func->found_varno;
|
597 | 582 | estate.ndatums=func->ndatums;
|
@@ -775,9 +760,6 @@ plpgsql_exec_trigger(PLpgSQL_function * func,
|
775 | 760 | elog(ERROR,"control reaches end of trigger procedure without RETURN");
|
776 | 761 | }
|
777 | 762 |
|
778 |
| -if (estate.auth_level!=PLPGSQL_AUTH_INVOKER) |
779 |
| -SetUserId(estate.invoker_uid); |
780 |
| - |
781 | 763 | /*
|
782 | 764 | * Check that the returned tuple structure has the same attributes,
|
783 | 765 | * the relation that fired the trigger has.
|
@@ -1040,10 +1022,6 @@ exec_stmt(PLpgSQL_execstate * estate, PLpgSQL_stmt * stmt)
|
1040 | 1022 | rc=exec_stmt_return(estate, (PLpgSQL_stmt_return*)stmt);
|
1041 | 1023 | break;
|
1042 | 1024 |
|
1043 |
| -casePLPGSQL_STMT_SETAUTH: |
1044 |
| -rc=exec_stmt_setauth(estate, (PLpgSQL_stmt_setauth*)stmt); |
1045 |
| -break; |
1046 |
| - |
1047 | 1025 | casePLPGSQL_STMT_RAISE:
|
1048 | 1026 | rc=exec_stmt_raise(estate, (PLpgSQL_stmt_raise*)stmt);
|
1049 | 1027 | break;
|
@@ -1667,29 +1645,6 @@ exec_stmt_return(PLpgSQL_execstate * estate, PLpgSQL_stmt_return * stmt)
|
1667 | 1645 | returnPLPGSQL_RC_RETURN;
|
1668 | 1646 | }
|
1669 | 1647 |
|
1670 |
| -/* ---------- |
1671 |
| - * exec_stmt_setauth Changes user ID to/from |
1672 |
| - * that of the function owner's |
1673 |
| - * ---------- |
1674 |
| - */ |
1675 |
| - |
1676 |
| -staticint |
1677 |
| -exec_stmt_setauth(PLpgSQL_execstate*estate,PLpgSQL_stmt_setauth*stmt) |
1678 |
| -{ |
1679 |
| -switch(stmt->auth_level) |
1680 |
| - { |
1681 |
| -casePLPGSQL_AUTH_DEFINER: |
1682 |
| -SetUserId(estate->definer_uid); |
1683 |
| -break; |
1684 |
| -casePLPGSQL_AUTH_INVOKER: |
1685 |
| -SetUserId(estate->invoker_uid); |
1686 |
| -break; |
1687 |
| -} |
1688 |
| - |
1689 |
| -estate->auth_level=stmt->auth_level; |
1690 |
| -returnPLPGSQL_RC_OK; |
1691 |
| -} |
1692 |
| - |
1693 | 1648 |
|
1694 | 1649 | /* ----------
|
1695 | 1650 | * exec_stmt_raiseBuild a message and throw it with
|
|