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

[plsql] WITH clause is ignored for SELECT INTO statements #4820

Closed
lbovet opened this issue Feb 14, 2024 · 0 comments · Fixed by #4825
Closed

[plsql] WITH clause is ignored for SELECT INTO statements #4820

lbovet opened this issue Feb 14, 2024 · 0 comments · Fixed by #4825
Labels
a:bug PMD crashes or fails to analyse a file.
Milestone

Comments

@lbovet
Copy link
Contributor

lbovet commented Feb 14, 2024

Affects PMD Version:

7.0.0-rc4

Description:

The AST dump ignores the WITH clause and it's content.

it outputs

<Statement CanonicalImage='' Image=''>
    <UnlabelledStatement CanonicalImage='' Image=''>
        <SqlStatement CanonicalImage='' Image='' Type=''>
            <Skip2NextTerminator CanonicalImage='' Image='' />
        </SqlStatement>
    </UnlabelledStatement>
</Statement>

for (snipped) input :

CREATE OR REPLACE PACKAGE BODY test_pack
IS
    FUNCTION get_name(p_id number) RETURN string
        IS
            l_name     string;
    BEGIN

       -- snip
        WITH base AS
                (SELECT id person_id, name person_name
                 FROM persons)
        SELECT person_name
        INTO l_name
        FROM base
        WHERE person_id = p_id;
       -- snap

        RETURN l_name;
    END get_name;
END test_pack;

Steps to reproduce:

Generate ast from above input

Running PMD through:

CLI

@lbovet lbovet added the a:bug PMD crashes or fails to analyse a file. label Feb 14, 2024
@adangel adangel changed the title [plqsl] WITH clause is ignored [plsql] WITH clause is ignored Feb 16, 2024
@adangel adangel changed the title [plsql] WITH clause is ignored [plsql] WITH clause is ignored for SELECT INTO statements Feb 16, 2024
@adangel adangel added this to the 7.0.0 milestone Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:bug PMD crashes or fails to analyse a file.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants