Eugene 🔒 lint report of examples/W14/good/1.sql

This is a human readable SQL script safety report generated by eugene. Keep in mind that lints can be ignored by adding a -- eugene: ignore E123 comment to the SQL statement or by passing --ignore E123 on the command line.

The migration script passed all the checks ✅

Statement number 1

SQL

-- 1.sql
create table authors(
    name text
)

No checks matched for this statement. ✅

Eugene 🔒 lint report of examples/W14/good/2.sql

This is a human readable SQL script safety report generated by eugene. Keep in mind that lints can be ignored by adding a -- eugene: ignore E123 comment to the SQL statement or by passing --ignore E123 on the command line.

The migration script passed all the checks ✅

Statement number 1

SQL

-- 2.sql
create unique index concurrently
    authors_name_key on authors(name)

No checks matched for this statement. ✅

Eugene 🔒 lint report of examples/W14/good/3.sql

This is a human readable SQL script safety report generated by eugene. Keep in mind that lints can be ignored by adding a -- eugene: ignore E123 comment to the SQL statement or by passing --ignore E123 on the command line.

The migration script passed all the checks ✅

Statement number 1

SQL

-- 3.sql
set local lock_timeout = '2s'

No checks matched for this statement. ✅

Statement number 2

SQL

-- eugene: ignore E2
-- This is a demo of W14, so we can ignore E2 instead of the
-- multi-step migration to make the column NOT NULL safely
alter table authors
    alter column name set not null

No checks matched for this statement. ✅

Eugene 🔒 lint report of examples/W14/good/4.sql

This is a human readable SQL script safety report generated by eugene. Keep in mind that lints can be ignored by adding a -- eugene: ignore E123 comment to the SQL statement or by passing --ignore E123 on the command line.

The migration script did not pass all the checks ❌

Statement number 1

SQL

-- 4.sql
alter table authors
    add constraint authors_name_pkey
        primary key using index authors_name_key

Lints

Taking dangerous lock without timeout

ID: E9

A lock that would block many common operations was taken without a timeout. This can block all other operations on the table indefinitely if any other transaction holds a conflicting lock while idle in transaction or active. A safer way is: Run SET LOCAL lock_timeout = '2s'; before the statement and retry the migration if necessary.

Statement takes lock on public.authors, but does not set a lock timeout.

Adding a primary key using an index

ID: W14

A primary key was added using an index on the table. This can cause postgres to alter the index columns to be NOT NULL. A safer way is: Make sure that all the columns in the index are already NOT NULL.

New primary key constraint using index on public.authors, may cause postgres to SET NOT NULL on columns in the index. This lint may be a false positive if the columns are already NOT NULL, ignore it by commenting the statement with -- eugene: ignore: W14.