bool is_instead;
char *ev_qual;
char *ev_action;
- List *actions = NIL;
+ List *actions;
Relation ev_relation;
TupleDesc viewResultDesc = NULL;
int fno;
Assert(!isnull);
is_instead = DatumGetBool(dat);
- /* these could be nulls */
fno = SPI_fnumber(rulettc, "ev_qual");
ev_qual = SPI_getvalue(ruletup, rulettc, fno);
+ Assert(ev_qual != NULL);
fno = SPI_fnumber(rulettc, "ev_action");
ev_action = SPI_getvalue(ruletup, rulettc, fno);
- if (ev_action != NULL)
- actions = (List *) stringToNode(ev_action);
+ Assert(ev_action != NULL);
+ actions = (List *) stringToNode(ev_action);
+ if (actions == NIL)
+ elog(ERROR, "invalid empty ev_action list");
ev_relation = table_open(ev_class, AccessShareLock);
generate_qualified_relation_name(ev_class));
/* If the rule has an event qualification, add it */
- if (ev_qual == NULL)
- ev_qual = "";
- if (strlen(ev_qual) > 0 && strcmp(ev_qual, "<>") != 0)
+ if (strcmp(ev_qual, "<>") != 0)
{
Node *qual;
Query *query;
}
appendStringInfoString(buf, ");");
}
- else if (list_length(actions) == 0)
- {
- appendStringInfoString(buf, "NOTHING;");
- }
else
{
Query *query;
bool is_instead;
char *ev_qual;
char *ev_action;
- List *actions = NIL;
+ List *actions;
Relation ev_relation;
int fno;
Datum dat;
Assert(!isnull);
is_instead = DatumGetBool(dat);
- /* these could be nulls */
fno = SPI_fnumber(rulettc, "ev_qual");
ev_qual = SPI_getvalue(ruletup, rulettc, fno);
+ Assert(ev_qual != NULL);
fno = SPI_fnumber(rulettc, "ev_action");
ev_action = SPI_getvalue(ruletup, rulettc, fno);
- if (ev_action != NULL)
- actions = (List *) stringToNode(ev_action);
+ Assert(ev_action != NULL);
+ actions = (List *) stringToNode(ev_action);
if (list_length(actions) != 1)
{