asterisk (GN028)#
Automatic fix is not available.
What it does#
Checks for usage of asterisk (*) in column references.
Why not?#
Specifying the columns in a query explicitly greatly improves clarity and readability. This approach helps developers quickly grasp the purpose of the query and fosters better collaboration.
Also, using asterisk () in column references complicates code maintenance. When the table structure changes, such as adding, renaming, or removing columns, queries with asterisk () can fail unexpectedly or silently return incorrect results. Examples are (SELECT * or RETURNING *).
By explicitly listing the necessary columns, you ensure the code is more resilient to changes in the database schema.
When should you?#
Almost Never.
Use instead:#
Name Columns Explicitly.