|
7 | 7 | *
|
8 | 8 | *
|
9 | 9 | * IDENTIFICATION
|
10 |
| - * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteDefine.c,v 1.29 1999/05/25 16:10:48 momjian Exp $ |
| 10 | + * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteDefine.c,v 1.30 1999/07/04 05:16:05 momjian Exp $ |
11 | 11 | *
|
12 | 12 | *-------------------------------------------------------------------------
|
13 | 13 | */
|
|
16 | 16 |
|
17 | 17 | #include "postgres.h"
|
18 | 18 |
|
| 19 | +#include "access/htup.h" |
19 | 20 | #include "access/heapam.h" /* access methods like amopenr */
|
| 21 | +#include "catalog/pg_rewrite.h" |
20 | 22 | #include "nodes/parsenodes.h"
|
21 | 23 | #include "nodes/pg_list.h" /* for Lisp support */
|
22 | 24 | #include "parser/parse_relation.h"
|
|
32 | 34 |
|
33 | 35 | Oid LastOidProcessed = InvalidOid;
|
34 | 36 |
|
35 |
| -/* |
36 |
| - * This is too small for many rule plans, but it'll have to do for now. |
37 |
| - * Rule plans, etc will eventually have to be large objects. |
38 |
| - * |
39 |
| - * should this be smaller? |
40 |
| - */ |
41 |
| -#define RULE_PLAN_SIZE BLCKSZ |
42 |
| - |
43 | 37 | static void
|
44 | 38 | strcpyq(char *dest, char *source)
|
45 | 39 | {
|
@@ -84,9 +78,9 @@ InsertRule(char *rulname,
|
84 | 78 | bool evinstead,
|
85 | 79 | char *actiontree)
|
86 | 80 | {
|
87 |
| - static char rulebuf[RULE_PLAN_SIZE]; |
88 |
| - static char actionbuf[RULE_PLAN_SIZE]; |
89 |
| - static char qualbuf[RULE_PLAN_SIZE]; |
| 81 | + static char rulebuf[MaxAttrSize]; |
| 82 | + static char actionbuf[MaxAttrSize]; |
| 83 | + static char qualbuf[MaxAttrSize]; |
90 | 84 | Oid eventrel_oid = InvalidOid;
|
91 | 85 | AttrNumber evslot_index = InvalidAttrNumber;
|
92 | 86 | Relation eventrel = NULL;
|
@@ -124,8 +118,8 @@ InsertRule(char *rulname,
|
124 | 118 | (rulename, ev_type, ev_class, ev_attr, ev_action, ev_qual, is_instead) VALUES \
|
125 | 119 | ('%s', %d::char, %u::oid, %d::int2, '%s'::text, '%s'::text, \
|
126 | 120 | '%s'::bool);";
|
127 |
| - if (strlen(template) + strlen(rulname) + strlen(actionbuf) + |
128 |
| - strlen(qualbuf) + 20 /* fudge fac */ > RULE_PLAN_SIZE) |
| 121 | + if (sizeof(FormData_pg_rewrite) + strlen(actionbuf) + |
| 122 | + strlen(qualbuf) > MaxAttrSize) |
129 | 123 | elog(ERROR, "DefineQueryRewrite: rule plan string too big.");
|
130 | 124 | sprintf(rulebuf, template,
|
131 | 125 | rulname, evtype, eventrel_oid, evslot_index, actionbuf,
|
|
0 commit comments