Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qvxe1-008pwh-7W for pgsql-docs@arkaria.postgresql.org; Thu, 26 Oct 2023 10:31:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qvxdy-00FkhA-OB for pgsql-docs@arkaria.postgresql.org; Thu, 26 Oct 2023 10:31:14 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qvxdy-00Fkh2-Cf for pgsql-docs@lists.postgresql.org; Thu, 26 Oct 2023 10:31:14 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by makus.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qvxdu-002OGB-9D for pgsql-docs@lists.postgresql.org; Thu, 26 Oct 2023 10:31:12 +0000 Received: from [172.30.2.10] (unknown [172.30.2.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: m.yablokov@postgrespro.ru) by mail.postgrespro.ru (Postfix/587) with ESMTPSA id 891D5E20E62; Thu, 26 Oct 2023 13:31:07 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mx2023; t=1698316267; bh=Say6mGaVJimlDpVVIYoWPKmtbanI87Nojg4fE63U0mw=; h=Message-ID:Date:User-Agent:Subject:To:Cc:References:From: In-Reply-To:From; b=pQ3Zar4mT9FGOySZRmkebGC0oa+k5jXfFByJmDtpqcZzPgDCxe29lU2LzYCCs5Tb5 VF/o+pNUNS3aCfvSuDws6t6fvurstnLz8AjORPN9pl96slqBlunF1WpTNZy0BoZY0P WYO307kDRVUuoQNWyu/oCs+2TDEuOsGugCqrjg0mLiyPIIbitEPBdIRB7FLM1P9U8B pq5JVjUfAhGfUOwsmyf82umLkz6x7jVvzodchdNZ6lEBmOJM1aCM5tMpCBUgy//xS8 RaWaNfuK5DF0xncEfeqKFwEhdKw+qBGuKyyUCrVWgw6WFkTYs8rm5h386PSAv5cUJ3 9ySuwjTHwDApA== Content-Type: multipart/mixed; boundary="------------hml0mTDmqimTj2g6tjdrq9UK" Message-ID: Date: Thu, 26 Oct 2023 13:31:07 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Example 43.6. A PL/pgSQL Trigger Function for Maintaining a Summary Table Content-Language: en-US To: Daniel Gustafsson Cc: pgsql-docs@lists.postgresql.org References: <70f74895-8512-4b2f-8617-2ac0ebcd2e87@postgrespro.ru> <99AC5F34-FDB6-42A8-867A-CF97F0707F9B@yesql.se> From: Maxim Yablokov Organization: Postgres Professional In-Reply-To: <99AC5F34-FDB6-42A8-867A-CF97F0707F9B@yesql.se> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------hml0mTDmqimTj2g6tjdrq9UK Content-Type: multipart/alternative; boundary="------------jgP7gYpBsHOVE5qYDVUaJHl0" --------------jgP7gYpBsHOVE5qYDVUaJHl0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit I believe that the attached patch should fix this problem. Please have a look. 26.10.2023 12:29, Daniel Gustafsson пишет: >> On 26 Oct 2023, at 09:33, Maxim Yablokov wrote: >> Example 43.6 on the pagehttps://www.postgresql.org/docs/16/plpgsql-trigger.html has two tables called main. But it seems that the table time_dimension is not used any further, it's a bit strange for one of main tables of the example. Am I missing something, or should this example be extended (or reduced)? > Interesting catch, time_dimension has been unused since introduced with commit > a294726bc1d (in 2005), and the archives doesn't provide any further insights. > While I don't have access to the book referred to for the example, we don't > expect our readers to either so it seems to me that we could remove it from the > example to avoid risk of confusion. Would you like to propose a patch for this? > > -- > Daniel Gustafsson > -- Best regards, Maxim Yablokov Technical writer-translator Postgres Professional --------------jgP7gYpBsHOVE5qYDVUaJHl0 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

I believe that the attached patch should fix this problem. Please have a look.

26.10.2023 12:29, Daniel Gustafsson пишет:
On 26 Oct 2023, at 09:33, Maxim Yablokov <m.yablokov@postgrespro.ru> wrote:

      
Example 43.6 on the page https://www.postgresql.org/docs/16/plpgsql-trigger.html has two tables called main. But it seems that the table time_dimension is not used any further, it's a bit strange for one of main tables of the example. Am I missing something, or should this example be extended (or reduced)?
Interesting catch, time_dimension has been unused since introduced with commit
a294726bc1d (in 2005), and the archives doesn't provide any further insights.
While I don't have access to the book referred to for the example, we don't
expect our readers to either so it seems to me that we could remove it from the
example to avoid risk of confusion. Would you like to propose a patch for this?

--
Daniel Gustafsson

--
Best regards,
Maxim Yablokov
Technical writer-translator
Postgres Professional
--------------jgP7gYpBsHOVE5qYDVUaJHl0-- --------------hml0mTDmqimTj2g6tjdrq9UK Content-Type: text/x-patch; charset=UTF-8; name="plpgsql-trigger.patch" Content-Disposition: attachment; filename="plpgsql-trigger.patch" Content-Transfer-Encoding: base64 ZGlmZiAtLWdpdCBhL2RvYy9zcmMvc2dtbC9wbHBnc3FsLnNnbWwgYi9kb2Mvc3JjL3NnbWwv cGxwZ3NxbC5zZ21sCmluZGV4IDgzZjg2N2Y5MWQyLi43MTAzYWIwM2I3NCAxMDA2NDQKLS0t IGEvZG9jL3NyYy9zZ21sL3BscGdzcWwuc2dtbAorKysgYi9kb2Mvc3JjL3NnbWwvcGxwZ3Nx bC5zZ21sCkBAIC00NDQ5LDE4ICs0NDQ5LDggQEAgSU5TVEVBRCBPRiBJTlNFUlQgT1IgVVBE QVRFIE9SIERFTEVURSBPTiBlbXBfdmlldwogCiA8cHJvZ3JhbWxpc3Rpbmc+CiAtLQotLS0g TWFpbiB0YWJsZXMgLSB0aW1lIGRpbWVuc2lvbiBhbmQgc2FsZXMgZmFjdC4KKy0tIE1haW4g dGFibGUgLSBzYWxlcyBmYWN0LgogLS0KLUNSRUFURSBUQUJMRSB0aW1lX2RpbWVuc2lvbiAo Ci0gICAgdGltZV9rZXkgICAgICAgICAgICAgICAgICAgIGludGVnZXIgTk9UIE5VTEwsCi0g ICAgZGF5X29mX3dlZWsgICAgICAgICAgICAgICAgIGludGVnZXIgTk9UIE5VTEwsCi0gICAg ZGF5X29mX21vbnRoICAgICAgICAgICAgICAgIGludGVnZXIgTk9UIE5VTEwsCi0gICAgbW9u dGggICAgICAgICAgICAgICAgICAgICAgIGludGVnZXIgTk9UIE5VTEwsCi0gICAgcXVhcnRl ciAgICAgICAgICAgICAgICAgICAgIGludGVnZXIgTk9UIE5VTEwsCi0gICAgeWVhciAgICAg ICAgICAgICAgICAgICAgICAgIGludGVnZXIgTk9UIE5VTEwKLSk7Ci1DUkVBVEUgVU5JUVVF IElOREVYIHRpbWVfZGltZW5zaW9uX2tleSBPTiB0aW1lX2RpbWVuc2lvbih0aW1lX2tleSk7 Ci0KIENSRUFURSBUQUJMRSBzYWxlc19mYWN0ICgKICAgICB0aW1lX2tleSAgICAgICAgICAg ICAgICAgICAgaW50ZWdlciBOT1QgTlVMTCwKICAgICBwcm9kdWN0X2tleSAgICAgICAgICAg ICAgICAgaW50ZWdlciBOT1QgTlVMTCwK --------------hml0mTDmqimTj2g6tjdrq9UK--