Inspectopedia
 
2024.3

Misleading references

Warning
New
Last modified: 03 December 2024

Reports ambiguous references in SQL code.

For example, when a name refer to both a table column and a routine parameter. The execution of such code might lead to errors or unexpected results due to counter-intuitive resolution logic. Usually, names with a more local scope have higher priority.

Example (PostgreSQL):

In PostgreSQL, you can use the #variable_conflict directives to explicitly specify a correct reference. For example, use #variable_conflict use_column to refer to a column name, or #variable_conflict use_variable to refer to a parameter.