Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RF02 triggered when passing a table as an argument to a function #5953

Open
2 of 3 tasks
CRBl69 opened this issue Jun 6, 2024 · 0 comments
Open
2 of 3 tasks

RF02 triggered when passing a table as an argument to a function #5953

CRBl69 opened this issue Jun 6, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@CRBl69
Copy link

CRBl69 commented Jun 6, 2024

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 = upper

Are you willing to work on and submit a PR to address the issue?

  • Yes I am willing to submit a PR!

Code of Conduct

@CRBl69 CRBl69 added the bug Something isn't working label Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant