mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-27 08:39:28 +08:00
Properly detoast access to bytea field pg_trigger.tgargs. Old code
might cause server crash. Backpatch to 8.2.X.
This commit is contained in:
parent
4e978c4e27
commit
ebe2830613
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.206 2006/10/13 21:43:18 tgl Exp $
|
* $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.206.2.1 2007/01/25 04:17:56 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -1790,8 +1790,7 @@ update_ri_trigger_args(Oid relid,
|
|||||||
* line; so does trigger.c ...
|
* line; so does trigger.c ...
|
||||||
*/
|
*/
|
||||||
tgnargs = pg_trigger->tgnargs;
|
tgnargs = pg_trigger->tgnargs;
|
||||||
val = (bytea *)
|
val = DatumGetByteaP(fastgetattr(tuple,
|
||||||
DatumGetPointer(fastgetattr(tuple,
|
|
||||||
Anum_pg_trigger_tgargs,
|
Anum_pg_trigger_tgargs,
|
||||||
tgrel->rd_att, &isnull));
|
tgrel->rd_att, &isnull));
|
||||||
if (isnull || tgnargs < RI_FIRST_ATTNAME_ARGNO ||
|
if (isnull || tgnargs < RI_FIRST_ATTNAME_ARGNO ||
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.210 2006/11/23 01:14:59 tgl Exp $
|
* $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.210.2.1 2007/01/25 04:17:56 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -906,8 +906,7 @@ RelationBuildTriggers(Relation relation)
|
|||||||
char *p;
|
char *p;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
val = (bytea *)
|
val = DatumGetByteaP(fastgetattr(htup,
|
||||||
DatumGetPointer(fastgetattr(htup,
|
|
||||||
Anum_pg_trigger_tgargs,
|
Anum_pg_trigger_tgargs,
|
||||||
tgrel->rd_att, &isnull));
|
tgrel->rd_att, &isnull));
|
||||||
if (isnull)
|
if (isnull)
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* ruleutils.c - Functions to convert stored expressions/querytrees
|
* ruleutils.c - Functions to convert stored expressions/querytrees
|
||||||
* back to source text
|
* back to source text
|
||||||
*
|
*
|
||||||
* $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.235 2006/11/10 22:59:29 tgl Exp $
|
* $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.235.2.1 2007/01/25 04:17:56 momjian Exp $
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
#include "postgres.h"
|
#include "postgres.h"
|
||||||
@ -519,8 +519,7 @@ pg_get_triggerdef(PG_FUNCTION_ARGS)
|
|||||||
char *p;
|
char *p;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
val = (bytea *)
|
val = DatumGetByteaP(fastgetattr(ht_trig,
|
||||||
DatumGetPointer(fastgetattr(ht_trig,
|
|
||||||
Anum_pg_trigger_tgargs,
|
Anum_pg_trigger_tgargs,
|
||||||
tgrel->rd_att, &isnull));
|
tgrel->rd_att, &isnull));
|
||||||
if (isnull)
|
if (isnull)
|
||||||
|
Loading…
Reference in New Issue
Block a user