Skip to content

self-assigning-column (GN036)#

Automatic fix is not available.

What it does#

Checks for self-assigning columns.

Why not?#

Assigning a column to itself does not change its value but still causes PostgreSQL to process the row as an update, create a new row version, creating unnecessary write amplification, dead tuples, WAL, and potential table and index bloats.

In most cases, this assignment is redundant or indicates that a different value was intended.

When should you?#

Almost never. Intentional self-assignments are rare and are typically used only to force UPDATE semantics, such as firing triggers.

Use instead:#

Use the correct value or remove the assignment entirely.