-
Notifications
You must be signed in to change notification settings - Fork 66
Closed
Description
Hello.
I am using this tool to lint my Postgres migrations (definitely prevented several headaches on deploy) and I found a false-positive:
BEGIN;
-- Create trigger api_user_update on model user
CREATE OR REPLACE FUNCTION "public"._pgtrigger_should_ignore(
trigger_name NAME
)
RETURNS BOOLEAN AS $$
DECLARE
_pgtrigger_ignore TEXT[];
BEGIN
IF _pgtrigger_ignore IS NOT NULL THEN
SELECT trigger_name = ANY(_pgtrigger_ignore)
-- And so on
COMMIT;
The migration/sql is courtesy of django-pgtrigger.
This gets flagged because of the if statement, which I think should not trip up the detection. It gets flagged here:
re.search("(?<!DROP )NOT NULL", sql) |
Some of my hand-written migrations also get flagged for this reason.
If I also may, I suggest that the .startswith()
checks should be .strip().lower().startswith()
to deal with possible future regressions because of indented/hand-written migrations
Metadata
Metadata
Assignees
Labels
No labels