Re: Change JOIN tutorial to focus more on explicit joins
Pavel Stehule <pavel.stehule@gmail.com>
From: Pavel Stehule <pavel.stehule@gmail.com>
To: Jürgen Purtz <juergen@purtz.de>
Cc: "David G. Johnston" <david.g.johnston@gmail.com>, Peter Eisentraut <peter.eisentraut@2ndquadrant.com>,
Thomas Munro <thomas.munro@gmail.com>, Thomas Kellerer <shammat@gmx.net>, Pg Docs <pgsql-docs@lists.postgresql.org>
Date: 2020-10-23T09:23:04Z
Lists: pgsql-hackers, pgsql-docs
pá 23. 10. 2020 v 11:14 odesílatel Jürgen Purtz <juergen@purtz.de> napsal: > On 22.10.20 17:14, Pavel Stehule wrote: > > > > Why do you use parenthesis for ON clause? It is useless. SQL is not C > > or JAVA. > > > Two more general answers: > - Why do people use tabs, spaces, and newlines to format their code even > though it's not necessary? SQL is a language to develop applications. > And what are the main costs of an application? It's not the time which > it takes to develop them. It's the time for their maintenance. During > the course of one or more decades, different persons will have to read > the code, add additional features, and fix bugs. They need some time to > read and understand the existing code. This task can be accelerated if > the code is easy to read. Therefore, it's a good habit of developers to > sometimes spend some extra characters to the code than is required - > not only comments. An example: there are clear precedence rules for > Boolean operators NOT/AND/OR. In an extensive statement it may be > helpful - for the developer himself as well as for anybody else -to use > newlines and parentheses at places where they are not necessary to keep > an overview of the intention of the statement. In such cases, > code-optimization is the duty of the compiler, not of the developer. > - In my professional life as a software developer, I have seen about 15 > different languages. But only in rare cases, they have offered new > features or concepts. To overcome this Babylonian linguistic diversity I > tend to use such syntactical constructs which are common to many of them > even, even if they are not necessary for the concrete language. > > And the concrete answer: Omitting the parentheses for the join condition > raises the danger that its Boolean operators are mixed with the Boolean > operators of the WHERE condition. The result at runtime is the same, but > a reader will understand the intention of the statement faster if the > parentheses exists. > I strongly disagree. If there are some boolean predicates, then parenthesis has sense. Without these predicates the parenthesis decrease readability. This is the sense of JOIN syntax to separate predicates. I have a different problem - when I see parentheses where they should not be, I am searching for a reason, and It is unfriendly where there is not any reason. I can understand if somebody uses useless parentheses in their product, but we talk about official documentation, and then we should respect the character of language. Regards Pavel > -- > > J. Purtz > > >
Commits
-
doc: Prefer explicit JOIN syntax over old implicit syntax in tutorial
- fb310f17812e 14.0 landed
-
doc: Change table alias names to lower case in tutorial chapter
- 49d716511789 14.0 landed
-
doc: Fix whitespace issue in PDF
- 79fd620b20b7 14.0 landed
-
doc: Use tags consistently in the tutorial chapter
- 6eee73e4e5b6 14.0 landed