Skip to content

Squawk Not Detecting Errors in PostgreSQL Function BodyΒ #411

@salgado-unleashed

Description

@salgado-unleashed

I'm trying to use squawk to lint a PostgreSQL function, but it seems like the function body is not being checked properly.
To test this, I deliberately introduced a syntax error (SELEC instead of SELECT), but squawk did not flag it as an issue.
Is there a known limitation with squawk when linting PostgreSQL functions?

  1. Create a SQL file (get_city_by_id.sql) with the following function:
CREATE OR REPLACE FUNCTION world.get_city_by_id(p_city_id BIGINT)
RETURNS TABLE(city_id BIGINT, city_name VARCHAR, country_id INT) AS
$$
BEGIN
    RETURN QUERY
    SELEC city_id, city_name, country_id
    FROM world.city
    WHERE city_id = p_city_id;
END;
$$ LANGUAGE plpgsql;
$ squawk get_city_by_id.sql --verbose
01:31:30 [INFO] no config file found
01:31:30 [INFO] pg version: None
01:31:30 [INFO] excluded rules: []
01:31:30 [INFO] excluded paths: []
01:31:30 [INFO] assume in a transaction: false
01:31:30 [INFO] checking file path: get_city_by_id.sql
Found 0 issues in 1 file πŸŽ‰

Does squawk support linting inside plpgsql function bodies?
Are there any configuration options required to enable deeper analysis?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions