Commit 5af6b2ab authored by Bruce Momjian's avatar Bruce Momjian

Properly detoast access to bytea field pg_trigger.tgargs. Old code

might cause server crash.

Backpatch to 8.2.X.
parent 25128176
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.210 2007/01/05 22:19:26 momjian Exp $
* $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.211 2007/01/25 04:17:45 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -1800,8 +1800,7 @@ update_ri_trigger_args(Oid relid,
* line; so does trigger.c ...
*/
tgnargs = pg_trigger->tgnargs;
val = (bytea *)
DatumGetPointer(fastgetattr(tuple,
val = DatumGetByteaP(fastgetattr(tuple,
Anum_pg_trigger_tgargs,
tgrel->rd_att, &isnull));
if (isnull || tgnargs < RI_FIRST_ATTNAME_ARGNO ||
......
......@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.211 2007/01/05 22:19:26 momjian Exp $
* $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.212 2007/01/25 04:17:46 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -906,8 +906,7 @@ RelationBuildTriggers(Relation relation)
char *p;
int i;
val = (bytea *)
DatumGetPointer(fastgetattr(htup,
val = DatumGetByteaP(fastgetattr(htup,
Anum_pg_trigger_tgargs,
tgrel->rd_att, &isnull));
if (isnull)
......
......@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.245 2007/01/20 23:13:01 tgl Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.246 2007/01/25 04:17:46 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -529,8 +529,7 @@ pg_get_triggerdef(PG_FUNCTION_ARGS)
char *p;
int i;
val = (bytea *)
DatumGetPointer(fastgetattr(ht_trig,
val = DatumGetByteaP(fastgetattr(ht_trig,
Anum_pg_trigger_tgargs,
tgrel->rd_att, &isnull));
if (isnull)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment