mirror of
https://github.com/postgres/postgres.git
synced 2025-06-13 07:41:39 +03:00
Eliminate pg_rewrite.ev_attr column and related dead code.
Commit 95ef6a3448
removed the
ability to create rules on an individual column as of 7.3, but
left some residual code which has since been useless. This cleans
up that dead code without any change in behavior other than
dropping the useless column from the catalog.
This commit is contained in:
@ -3734,7 +3734,6 @@ make_ruledef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc,
|
||||
char *rulename;
|
||||
char ev_type;
|
||||
Oid ev_class;
|
||||
int16 ev_attr;
|
||||
bool is_instead;
|
||||
char *ev_qual;
|
||||
char *ev_action;
|
||||
@ -3761,11 +3760,6 @@ make_ruledef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc,
|
||||
Assert(!isnull);
|
||||
ev_class = DatumGetObjectId(dat);
|
||||
|
||||
fno = SPI_fnumber(rulettc, "ev_attr");
|
||||
dat = SPI_getbinval(ruletup, rulettc, fno, &isnull);
|
||||
Assert(!isnull);
|
||||
ev_attr = DatumGetInt16(dat);
|
||||
|
||||
fno = SPI_fnumber(rulettc, "is_instead");
|
||||
dat = SPI_getbinval(ruletup, rulettc, fno, &isnull);
|
||||
Assert(!isnull);
|
||||
@ -3820,10 +3814,6 @@ make_ruledef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc,
|
||||
|
||||
/* The relation the rule is fired on */
|
||||
appendStringInfo(buf, " TO %s", generate_relation_name(ev_class, NIL));
|
||||
if (ev_attr > 0)
|
||||
appendStringInfo(buf, ".%s",
|
||||
quote_identifier(get_relid_attribute_name(ev_class,
|
||||
ev_attr)));
|
||||
|
||||
/* If the rule has an event qualification, add it */
|
||||
if (ev_qual == NULL)
|
||||
@ -3925,7 +3915,6 @@ make_viewdef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc,
|
||||
Query *query;
|
||||
char ev_type;
|
||||
Oid ev_class;
|
||||
int16 ev_attr;
|
||||
bool is_instead;
|
||||
char *ev_qual;
|
||||
char *ev_action;
|
||||
@ -3943,9 +3932,6 @@ make_viewdef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc,
|
||||
fno = SPI_fnumber(rulettc, "ev_class");
|
||||
ev_class = (Oid) SPI_getbinval(ruletup, rulettc, fno, &isnull);
|
||||
|
||||
fno = SPI_fnumber(rulettc, "ev_attr");
|
||||
ev_attr = (int16) SPI_getbinval(ruletup, rulettc, fno, &isnull);
|
||||
|
||||
fno = SPI_fnumber(rulettc, "is_instead");
|
||||
is_instead = (bool) SPI_getbinval(ruletup, rulettc, fno, &isnull);
|
||||
|
||||
@ -3965,7 +3951,7 @@ make_viewdef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc,
|
||||
|
||||
query = (Query *) linitial(actions);
|
||||
|
||||
if (ev_type != '1' || ev_attr >= 0 || !is_instead ||
|
||||
if (ev_type != '1' || !is_instead ||
|
||||
strcmp(ev_qual, "<>") != 0 || query->commandType != CMD_SELECT)
|
||||
{
|
||||
appendStringInfo(buf, "Not a view");
|
||||
|
Reference in New Issue
Block a user