Skip to content
Snippets Groups Projects
Commit ede5a418 authored by Bruce Momjian's avatar Bruce Momjian
Browse files

Clean up maximum rewrite tuple length.

parent eba41848
No related branches found
No related tags found
No related merge requests found
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteDefine.c,v 1.29 1999/05/25 16:10:48 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteDefine.c,v 1.30 1999/07/04 05:16:05 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -16,7 +16,9 @@
#include "postgres.h"
#include "access/htup.h"
#include "access/heapam.h" /* access methods like amopenr */
#include "catalog/pg_rewrite.h"
#include "nodes/parsenodes.h"
#include "nodes/pg_list.h" /* for Lisp support */
#include "parser/parse_relation.h"
......@@ -32,14 +34,6 @@
Oid LastOidProcessed = InvalidOid;
/*
* This is too small for many rule plans, but it'll have to do for now.
* Rule plans, etc will eventually have to be large objects.
*
* should this be smaller?
*/
#define RULE_PLAN_SIZE BLCKSZ
static void
strcpyq(char *dest, char *source)
{
......@@ -84,9 +78,9 @@ InsertRule(char *rulname,
bool evinstead,
char *actiontree)
{
static char rulebuf[RULE_PLAN_SIZE];
static char actionbuf[RULE_PLAN_SIZE];
static char qualbuf[RULE_PLAN_SIZE];
static char rulebuf[MaxAttrSize];
static char actionbuf[MaxAttrSize];
static char qualbuf[MaxAttrSize];
Oid eventrel_oid = InvalidOid;
AttrNumber evslot_index = InvalidAttrNumber;
Relation eventrel = NULL;
......@@ -124,8 +118,8 @@ InsertRule(char *rulname,
(rulename, ev_type, ev_class, ev_attr, ev_action, ev_qual, is_instead) VALUES \
('%s', %d::char, %u::oid, %d::int2, '%s'::text, '%s'::text, \
'%s'::bool);";
if (strlen(template) + strlen(rulname) + strlen(actionbuf) +
strlen(qualbuf) + 20 /* fudge fac */ > RULE_PLAN_SIZE)
if (sizeof(FormData_pg_rewrite) + strlen(actionbuf) +
strlen(qualbuf) > MaxAttrSize)
elog(ERROR, "DefineQueryRewrite: rule plan string too big.");
sprintf(rulebuf, template,
rulname, evtype, eventrel_oid, evslot_index, actionbuf,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment