Open
Description
This happens if vars are derived but none of them are ever used in the rule.
The result is basically an empty select or an unknown loop var.
In practice this should rarely happen but it should be caught nonetheless and a warning should be thrown.
Also the select and empty loop should never be translated.
Sample IFLog Code that produces that error:
def A(x: int, y: int) {}
def B(y: int) {}
C() {
r0: print(c) :- A(a, c) | B(b), b > 3;
r1: noaction :- A(a, _), multi(a);
}
Resulting PostgreSQL Code:
CREATE TABLE A(
x INTEGER NOT NULL,
y INTEGER NOT NULL
);
CREATE TABLE B(
y INTEGER NOT NULL
);
CREATE FUNCTION C() RETURNS VOID
LANGUAGE PLPGSQL
SECURITY DEFINER
AS
$BODY$
#variable_conflict error
-- #variable_conflict use_variable
-- #variable_conflict use_column
DECLARE
lvar0_c INTEGER;
lvar0_print_0 INTEGER;
BEGIN
SELECT t0.y INTO STRICT lvar0_c
FROM A t0;
SELECT INTO STRICT
FROM B t0
WHERE t0.y > 3;
lvar0_print_0 := lvar0_c;
RAISE NOTICE '%', lvar0_print_0;
FOR lvar1_a IN SELECT t0.x
FROM A t0
LOOP
END LOOP;
END
$BODY$;