False positive with RLS Alter table
kaushalyap opened this issue Β· comments
Kaushalya Pradeep commented
... : warning: prefer-robust-stmts
ALTER TABLE IF EXISTS
tbl_name ENABLE ROW LEVEL SECURITY;
help: Consider wrapping in a transaction or adding a IF NOT EXISTS clause if the statement supports it.
Christopher Dignam commented
@kaushalyap Can you provide a full example the replicates the issue? The provided example doesn't error.
echo 'ALTER TABLE IF EXISTS tbl_name ENABLE ROW LEVEL SECURITY;' | squawk
Found 0 issues in 1 file π
Chris Prahl commented
I think I am running into the same issue. Tests on a single line work just fine there is a statement right before it fails:
$ echo 'ALTER TABLE IF EXISTS test ENABLE ROW LEVEL SECURITY;' | squawk
Found 0 issues in 1 file π
$ echo 'CREATE TABLE IF NOT EXISTS test();\nALTER TABLE IF EXISTS test ENABLE ROW LEVEL SECURITY;' | squawk
stdin:2:1: warning: prefer-robust-stmts
2 | ALTER TABLE IF EXISTS test ENABLE ROW LEVEL SECURITY;
help: Consider wrapping in a transaction or adding a IF NOT EXISTS clause if the statement supports it.
find detailed examples and solutions for each rule at https://squawkhq.com/docs/rules
$ squawk --version
squawk 1.1.2
Steve Dignam commented
Looks like a bug, thanks for the repro!