darold / pgFormatter

A PostgreSQL SQL syntax beautifier that can work as a console program or as a CGI. On-line demo site at http://sqlformat.darold.net/
PostgreSQL License
1.69k stars 101 forks source link

Bad indentation of the "ELSE" when using "CASE". #330

Closed VinceT closed 8 months ago

VinceT commented 10 months ago

Here is an example. Non-default options were : New-line after comma (insert) No space function call Functions: lower case

8<------------------------------------------------------------------------------------------ SELECT ligne.numligne, ligne.numero, ligne.date_mouvement, ligne.libelle, ligne.debit, ligne.credit, releve.releve_uuid, releve.date_fin, compte.compte_uuid, compte.numcompte, devise.devise_uuid, devise.code, CASE WHEN ligne.typemvt IS NULL THEN ( SELECT typemvt_uuid FROM typemvt WHERE upper(typemvt.code) = 'PRELEVEMENT') ELSE ( SELECT typemvt_uuid FROM typemvt WHERE upper(typemvt.code) = upper(ligne.typemvt)) END, ligne.ligne_uuid, analytique.analytique_uuid FROM ligne INNER JOIN releve ON (releve.releve_uuid = ligne.releve_uuid) INNER JOIN compte ON (compte.compte_uuid = releve.compte_uuid), devise, analytique WHERE ligne_uuid = :ligne_uuid AND devise.defaut = 'O' AND upper(analytique.groupe) = 'DIVERS'; 8<------------------------------------------------------------------------------------------

darold commented 8 months ago

Commit 9e104c6 fixes this issues.