RF02 triggered when passing a table as an argument to a function
Author: CRBl69Created Jun 6, 2024Updated Sep 6, 2026
Labelsbugpostgresrule bug
Search before asking
- I searched the issues and found no similar issues.
What Happened
When passing a table as an argument to a function, RF02 is reported.
Expected Behaviour
RF02 should not be reported, as the table does not need a qualifier.
Observed Behaviour
L: 16 | P: 28 | RF02 | Unqualified reference 'mytable' found in select with
| more than one referenced table/view.
| [references.qualification]How to reproduce
CREATE TABLE mytable (
a int,
b int
);
CREATE TABLE othertable (
c int
);
CREATE FUNCTION myadd(mytable)
RETURNS NUMERIC AS $$
SELECT $1.a + $1.b;
$$ IMMUTABLE LANGUAGE sql;
CREATE VIEW myview AS
SELECT othertable.c, myadd(mytable) FROM mytable, othertable;Dialect
PostgreSQL
Version
sqlfluff, version 3.0.4
Configuration
[sqlfluff]
dialect = postgres
templater = raw
max_line_length = 120
processes = -1
[sqlfluff:rules:capitalisation.keywords]
capitalisation_policy = upperAre you willing to work on and submit a PR to address the issue?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct
Source: sqlfluff/sqlfluff