Trivadis / plsql-and-sql-coding-guidelines

Trivadis PL/SQL & SQL Coding Guidelines

Home Page:https://trivadis.github.io/plsql-and-sql-coding-guidelines/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Simplify G-1050 and related examples

PhilippSalvisberg opened this issue · comments

This version of G-1050 describes the following exceptions:

  1. Literals in logger calls
  2. Literals in views
  3. Literals that are used less than 3 times in a file

Number 2 and number 3 have been introduced after the release of version 4.2. After some consideration this rule is

a) too complicated and
b) not stringent.

For example, literals in views are okay, but not OK in SQL Scripts with insert statements? Additionally, the exclusion of views is based on some corner cases where a function wrapping a constant is leading to a bad execution plan.

To simplify the rule, let's state the following (replacing the last three paragraphs):

To avoid an extreme abundance of constants or false positives, a literal should not occur more than once within a file.

Furthermore the examples in the chapter "Language Usages" should simplified accordingly.