Skip to content

Releases: Trivadis/plsql-and-sql-coding-guidelines

Trivadis PL/SQL & SQL Coding Guidelines v4.4

20 Mar 16:16
Compare
Choose a tag to compare

Version 4.4

https://trivadis.github.io/plsql-and-sql-coding-guidelines/v4.4/
PLSQL-and-SQL-Coding-Guidelines.pdf

Items marked with a 👮 require a change in the Linter tool suite db* CODECOP (besides including the changed guideline texts).

New

  • #210 Highlight the lines that violate a guideline in the bad examples (and the fixed lines in the good examples)
  • #212 New guideline G-3330: Avoid autonomous transactions. 👮
  • #213 New guideline G-4387: Never use a FOR LOOP for a query that should return not more than one row.

Changed

  • #208 Include column alias in the title of G-3182
    • old: G-3182: Always specify column names instead of positional references in GROUP BY clauses.
    • new: G-3182: Always specify column names/aliases instead of positional references in GROUP BY clauses.

Fixed

  • #205 Fix revision history in about page

Trivadis PL/SQL & SQL Coding Guidelines v4.3

27 Sep 16:00
Compare
Choose a tag to compare

Version 4.3

https://trivadis.github.io/plsql-and-sql-coding-guidelines/v4.3/
PLSQL-and-SQL-Coding-Guidelines.pdf

Items marked with a 👮 require a change in the Linter tool suite db* CODECOP (besides including the changed guideline texts).

New

  • #124 Mention "PL/SQL & SQL Formatter Settings" in the "Tool Support" chapter
  • #169 Automatically check Markdown files with SonarCloud
    • all SQL text blocks should follow these guidelines
    • as a side effect syntax errors in SQL text blocks were detected and fixed
    • due to the bad examples in the guidelines, it's expected that the project on SonarCloud will not meet the quality gate goals
  • #197 New rule G-3182: Always specify column names instead of positional references in GROUP BY clauses. 👮
  • #202 New rule G-3183: Always specify column aliases instead of expressions in GROUP BY clauses. 👮

Changed / Improved

  • #159 Use create or replace in G-9010/G-9020/G-9030 to avoid violation of G-7125
  • #160 Avoid violation of G-2340 in G-2330
  • #161 Do not violate G-7160 in G-5080
  • #162 Do not violate G-4320 in G-3310/G-3320
  • #163 Do not violate G-1020 in the bad example of G-4325
  • #164 Do not violate G-2135 in the good and bad example of G-2120/G-2130
  • #165 Do not violate G-2135 in the good and bad example of G-2145
  • #166 Do not violate G-7510 in the good example of G-5080
  • #167 Do not use the keyword upsert in the good and bad example of G-7160
  • #171 Do not violate naming conventions in the good and bad example of G-2610
  • #172 Do not violate naming conventions in the good example of G-5030
  • #173 Do not violate naming conventions in the good example of G-5070
  • #174 Do not violate naming conventions in the good example of G-3320
  • #175 Fix issues reported by SonarCloud regarding HTML and CSS
  • #176 Do not violate G-7510 in chapter of complexity analysis
  • #180 Make G-1050 less strict by using a threshold parameter 👮
  • #182 Make G-8310 less strict by limiting the scope of data types 👮
  • #200 Fix categorization of guideline severities 👮
  • #205 Use 3 identical literals in the bad example of G-1050
  • #206 Simplify G-1050 and related examples

Fixed

  • #168 Syntax error in example of docs/3-coding-style/coding-style.md
  • #179 Eliminate violations of G-1050
  • #181 Eliminate violations of G-8310
  • #203 The tools do not work from a Windows host with git-bash (PR by @zrh535)

Trivadis PL/SQL & SQL Coding Guidelines v4.2

15 Aug 13:12
Compare
Choose a tag to compare

Version 4.2

https://trivadis.github.io/plsql-and-sql-coding-guidelines/v4.2/
PLSQL-and-SQL-Coding-Guidelines.pdf

Changed / Improved

  • #126 Write Oracle Database instead of Oracle
  • #127 Update Docker image mktools (mkdocs-1.3.1, mkdocs-material-8.3.9, mike-1.1.2)
  • #127 Provide Docker image trivadis/mktools:4.0 for linux/amd64 and linux/arm64
  • #128 Format the good example in G-1060 as the bad one
  • #129 Format the good example in G-3110
  • #130 Ensure the SQL code block is valid
  • #131 Format the examples in G-7710 and G-7720
  • #132 Replace PL/SQL Cop with db* CODECOP
  • #134 Do not violate rule G-4320 in examples of G-3145
  • #137 Do not violate rule G-7125 in examples of G-9040
  • #155 HTML site behaves like a single page application (try n and p keys)
  • #155 Show version selector after page title (instead of plain version number)
  • #157 Update MathJax library to version 3

Fixed

  • #125 Invalid code in examples of G-7910
  • #133 Escaping of star in G-3145 is visible
  • #135 Missing INTO clause in SELECT statements of G-8310
  • #136 Invalid Index indx used in good example of G-3220
  • #139 Icon for severity of rules lost in PDF
  • #140 Missing guideline version in title (during v4.2 development)
  • #157 arithmatex symbols not shown when using navigation.instant (during v4.2 development)

Trivadis PL/SQL & SQL Coding Guidelines v4.1

18 Jul 20:08
Compare
Choose a tag to compare

Version 4.1

https://trivadis.github.io/plsql-and-sql-coding-guidelines/v4.1/
PLSQL-and-SQL-Coding-Guidelines.pdf

New

  • #120 - Added new rule G-7910: Never use DML within a SQL macro.
  • #23 - Added new rule G-3220: Always process saved exceptions from a FORALL statement.
  • #49 - Added new rule G-4365: Never use unconditional CONTINUE or EXIT in a loop.
  • #46 - Added new rule G-3145: Avoid using SELECT * directly from a table or view.
  • #100 - Added new rule G-9040: Try using FX in string to date/time conversion format model to avoid fuzzy conversion.
  • #111 - Formatted all examples according to coding style in our guidelines.
  • #111 - Added automatic formatting of examples using git hook.

Changed

  • #8 / #9 - Restructured Tool Support section with individual chapters on 4 db*CODECOP tools as well as plscope-util.
  • #103 - Unique subchapters per rule and consistent order.
  • #117 - Consistent handling of the Oracle database version.
  • #122 - Consistent case of the word Oracle.
  • #114 - G-7730: Clarify scope.
  • #105 - G-4220 violates rule G-1050 in bad and good example.
  • #91 - G-7730 valid in all cases or only if PK is assigned.
  • #109 - Update images, logos, favicon, etc. due to acquisition of Trivadis by Accenture leading to updated corporate design.

Fixed

  • #106 - Appendix B: Old ID 68 -> New ID 7160.
  • #104 - Bad example in G-4210 violates rule G-2130 in line 2.
  • #116 - G-9020/G-9030: syntax error in good and bad example.
  • #115 - G-9010: syntax error in good and bad example.
  • #113 - G-7330: Wrong procedure label in bad and good examples.
  • #112 - G-7810: Fix typo in SQL.
  • #102 - G-2230: Add deterministic keyword to avoid violating G-7460.
  • Fixed typos in G-7310 and G-7410.

Trivadis PL/SQL & SQL Coding Guidelines v4.0

03 Feb 19:33
Compare
Choose a tag to compare

Version 4.0

https://trivadis.github.io/plsql-and-sql-coding-guidelines/v4.0/
PLSQL-and-SQL-Coding-Guidelines.pdf

Breaking Changes

  • #57 - Changed Code Style Rule 1 from “Keywords are written uppercase, names are written in lowercase“ to "Keywords and names are written in lowercase”
    • added reason for this change
    • updated all code examples
  • #81 - Removed G-7240 (Avoid using an IN OUT parameter as IN or OUT only) and replaced it with these rules:
    • G-7160: Always explicitly state parameter mode.
    • G-7170: Avoid using an IN OUT parameter as IN or OUT only.

New

  • #28 - G-1080: Avoid using the same expression on both sides of a relational comparison operator or a logical operator.
  • #48 - G-2135: Avoid assigning values to local variables that are not used by a subsequent statement.
  • #34 - G-2145: Never self-assign a variable.
  • #54 - G-2610: Never use self-defined weak ref cursor types.
  • #34 - G-3115: Avoid self-assigning a column.
  • #26 - G-3185: Never use ROWNUM at the same query level as ORDER BY.
  • #38 - G-3195: Always use wildcards in a LIKE clause.
  • #22 - G-3310: Never commit within a cursor loop.
  • #22 - G-3320: Try to move transactions within a non-cursor loop into procedures.
  • #31 - G-4250: Avoid using identical conditions in different branches of the same IF or CASE statement.
  • #44/#90 - G-4260: Avoid inverting boolean conditions with NOT.
  • #45 - G-4270: Avoid comparing boolean values to boolean literals.
  • #50 - G-4325: Never reuse labels in inner scopes.
  • #36 - G-5080: Always use FORMAT_ERROR_BACKTRACE when using FORMAT_ERROR_STACK or SQLERRM.
  • #35 - G-7125: Always use CREATE OR REPLACE instead of CREATE alone.
  • #25 - G-7250: Never use RETURN in package initialization block.
  • #30 - G-7330: Always assign values to OUT parameters.
  • #27 - G-7720: Never use multiple UPDATE OF in trigger event clause.
  • #84 - G-7730: Avoid multiple DML events per trigger if primary key is assigned in trigger.
  • #40 - G-9010: Always use a format model in string to date/time conversion functions.
  • #40 - G-9020: Try to use a format model and NLS_NUMERIC_CHARACTERS in string to number conversion functions.
  • #40 - G-9030: Try to define a default value on conversion errors.
  • #88/#89 - Added "Unsupported in PL/SQL Cop Validators” section for every guideline without validator in PL/SQL Cop

Changed

  • #77 - G-5040: Added exception for logging framework calls
  • #78 - G-1050: Added exception for logging framework calls
  • #79 - G-7230: Added exception for constants
  • #85 - G-4220: Added warning regarding different NULL handling in DECODE and CASE
  • #93/#98 - Updated Appendix B with changed/new rules
  • #95 - Updated trivadis/mktools docker image
  • #97 - Included Material for MkDocs 6.0 in trivadis/mktools docker image

Fixed

  • #87 - Fixed typo in coding-style.md
  • #92 - G-3190 added a newline
  • #94 - G-3310 added a better example

Trivadis PL/SQL & SQL Coding Guidelines v3.6

28 Sep 11:09
Compare
Choose a tag to compare

Version 3.6

https://trivadis.github.io/plsql-and-sql-coding-guidelines/v3.6/
PLSQL-and-SQL-Coding-Guidelines.pdf

Fixed

  • #74 - Dead links in introduction chapter
  • #76 - Changed title of Urban Lankes in foreword

Trivadis PL/SQL & SQL Coding Guidelines v3.5

21 Sep 17:08
Compare
Choose a tag to compare

Version 3.5

https://trivadis.github.io/plsql-and-sql-coding-guidelines/v3.5/
PLSQL-and-SQL-Coding-Guidelines.pdf

Improved

  • #13 - PLSQL-and-SQL-Coding-Guidelines.pdf included in HTML site in chapter Appendix
  • #73 - Static text in revision history with link to release information

Trivadis PL/SQL & SQL Coding Guidelines v3.4

20 Sep 14:11
Compare
Choose a tag to compare

Version 3.4

https://trivadis.github.io/plsql-and-sql-coding-guidelines/v3.4/
PLSQL-and-SQL-Coding-Guidelines.pdf

New

  • #55 - Added naming conventions for check constraints (_ck suffix)
  • #56 - Added section "We do not agree with all your standards" in introduction chapter
  • #56 - Added footnote for tables, views; explaining why we use plurals in naming conventions chapter
  • #56 - Added footnote for indention; explaining why we use 3 spaces in coding style chapter
  • #70 - Extended naming conventions for views and tables regarding EBR (_eb suffix)

Improved

  • #4 - Renamed the use of "ANSI-join" to "ANSI SQL-92 join" (title and reason in G-3130)
  • #7 - Renamed G-8420 to G-8510 to follow numbering rules (new chapter)
  • #14 - Do not wrap lines in code blocks on devices with small screen widths
  • #61 - Add explanation to good example of G-3150 regarding GENERATED ALWAYS AS IDENTITY
  • #62 - Renamed G-3160 from
    "Avoid virtual columns to be visible" to
    "Avoid visible virtual columns"
  • #63 - Add char semantic in column of G-3170
  • #64 - Improved formatting of bad example in G-4220 (decode)
  • #67 - Renamed G-8410 from
    "Always use application locks to ensure a program unit only running once at a given time" to
    "Always use application locks to ensure a program unit is only running once at a given time"
  • Updated Trivadis logo (without slogan "makes IT easier")

Fixed

  • #18 - Example uses one parameter, G-7110 is applied only for two and more parameters
  • #20 - Added missing G- prefix in G-7320
  • #21 - Incomplete good and bad examples in G-8410
  • #65 - Broken link in G-4310, McConnell, Steve C. (2004). Code Complete. Second Edition. Microsoft Press.
  • #66 - Grammar in bad example of G-5030
  • #67 - Wrong parameter in bad example of G-8410 (in_lock_handle instead of in_lock_name)
  • #68 - Typo in reason of G-8510

Trivadis PL/SQL & SQL Coding Guidelines v3.3

07 Jul 21:41
Compare
Choose a tag to compare

Version 3.3

https://trivadis.github.io/plsql-and-sql-coding-guidelines/v3.3/
PLSQL-and-SQL-Coding-Guidelines.pdf

Improved

  • #1 Split single word document into several markup files
  • #6 Ensure that every rule in chapter 4 (Language usage) has a reason

Trivadis PL/SQL & SQL Coding Guidelines v3.2

13 Jun 10:35
Compare
Choose a tag to compare

Version 3.2

PLSQL-and-SQL-Coding-Guidelines.pdf

  • Released in January 2017
  • Various small corrections