Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kVtIa-0005Za-AE for pgsql-docs@arkaria.postgresql.org; Fri, 23 Oct 2020 09:23:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kVtIY-0008NC-Lh for pgsql-docs@arkaria.postgresql.org; Fri, 23 Oct 2020 09:23:46 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kVtIX-0008N4-C2 for pgsql-docs@lists.postgresql.org; Fri, 23 Oct 2020 09:23:45 +0000 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kVtIU-00047V-Iv for pgsql-docs@lists.postgresql.org; Fri, 23 Oct 2020 09:23:43 +0000 Received: by mail-pf1-x430.google.com with SMTP id 126so280937pfu.4 for ; Fri, 23 Oct 2020 02:23:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=i0/hoTRH+s5KSqdP7k0W9Ngd9jPNLLDeybSLhB3IiTA=; b=AP9Sn0PQH1OG40TTZDCvuH/HlpnznjEc5SsgPXhAHP5Ls71QuS7dH6RRb2PMZNGK+D LmaN/G1UmmfrPGSjL4JM8s4yc7yE6vcO5t/CsJK+Xc1ZE2F3OdeEacVtH3CtHkkQYSO9 Ch5m2pIivBRRdRD1bruboPuifVCmkb15RvN4A85rkRX+EyJJINLcRvDtlEuI+wMiEMHC MjZ0kW+dCmRO3IA4ARtxjJ74iTHLYk0iFlhJ7zu+A4MxmWmCjwPN/IJ3did07Bu/dj1m 0o2mgrgOxzYp1lNdRC86VgjLt9dkTIZwcXVPHDl22PnUq8VE7Mwa+97n1iqnoGoqd8II jNZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=i0/hoTRH+s5KSqdP7k0W9Ngd9jPNLLDeybSLhB3IiTA=; b=J/t4uApMhNohOBEXggd71PyBgGTtk7FfJ1lMc3mN2AbIkMS8ywelpz0UJIJ8AtMsLJ ID2ruAAlViMewkExe0P3J0+SaRmNViSTpJrm4ABbKi+j7a8PVt0dEM7AflkZw5lE83NZ yz5EAoQCsj1PrB2hHuWXv89AUq32jZoM4tVJeSpJHImTMt5w5ONoShweQ7byX4IrK+hR SvX6ttcRTLfwvve4EkB/aPtcc5xsMoV4PFSPf/apbynwZMft957sRsc3ezvWjjvlLj95 FrZ8qFub/PESBNDmQOHBnBvgv5Unz//UhPyRJ+0sABU1lU/1hce+nHNgzDKKaYJmwRV1 1T5w== X-Gm-Message-State: AOAM531yg6grMg8PONyio6Kf0WqxNTiw3yPNvbwiYEfYXQelXwWq5hu9 A+5mOsQihmqrBB5DosMe9etnuMdUHeuzz05RXns= X-Google-Smtp-Source: ABdhPJxt9qfj+UeOeRDYmW3uRtzOR5LDOZ+RxY/uAVInAnoFAbAAjVAdi/dgflVF5PQlvD4c1oVEzNmlvTuBbDSJUtI= X-Received: by 2002:a17:90a:d185:: with SMTP id fu5mr1410871pjb.39.1603445021193; Fri, 23 Oct 2020 02:23:41 -0700 (PDT) MIME-Version: 1.0 References: <158996922318.7035.10603922579567326239@wrigleys.postgresql.org> <9fd4b399-37c8-014e-e7ef-08fb0ecbbdcc@2ndquadrant.com> <791cac8a-e5f7-a79c-d651-dfa3ecc1453e@purtz.de> <81d5be9d-aa6f-f181-bea9-5a852b876cad@purtz.de> In-Reply-To: <81d5be9d-aa6f-f181-bea9-5a852b876cad@purtz.de> From: Pavel Stehule Date: Fri, 23 Oct 2020 11:23:04 +0200 Message-ID: Subject: Re: Change JOIN tutorial to focus more on explicit joins To: =?UTF-8?Q?J=C3=BCrgen_Purtz?= Cc: "David G. Johnston" , Peter Eisentraut , Thomas Munro , Thomas Kellerer , Pg Docs Content-Type: multipart/alternative; boundary="000000000000e7bc5205b25322af" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --000000000000e7bc5205b25322af Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable p=C3=A1 23. 10. 2020 v 11:14 odes=C3=ADlatel J=C3=BCrgen Purtz 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 > > > --000000000000e7bc5205b25322af Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
p=C3=A1 23. 10. 2020 v=C2=A011:14 ode= s=C3=ADlatel J=C3=BCrgen Purtz <juer= gen@purtz.de> napsal:
On 22.10.20 17:14, Pavel Stehule wrote:
>
> Why do you use parenthesis for ON clause?=C2=A0 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. <= br> 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 <= br> 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 -=C2=A0 =
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 paren= thesis has sense. Without these predicates the parenthesis decrease readabi= lity. 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 wher= e there is not any reason. I can understand if somebody uses useless parent= heses in their product, but we talk about official documentation, and then = we should respect the character of language.=C2=A0

Regards

Pavel

=

--

J. Purtz


--000000000000e7bc5205b25322af--