From m.yablokov@postgrespro.ru Thu Oct 26 07:33:50 2023 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 1qvusW-008VQS-4q for pgsql-docs@arkaria.postgresql.org; Thu, 26 Oct 2023 07:34:04 +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 1qvusU-00E3cD-MF for pgsql-docs@arkaria.postgresql.org; Thu, 26 Oct 2023 07:34:02 +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 1qvusU-00E3c4-AA for pgsql-docs@lists.postgresql.org; Thu, 26 Oct 2023 07:34:02 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by makus.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qvusQ-002Ms4-St for pgsql-docs@lists.postgresql.org; Thu, 26 Oct 2023 07:34:01 +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 437A5E20E62 for ; Thu, 26 Oct 2023 10:33:56 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mx2023; t=1698305636; bh=RojBj7+3f9WN0WaOmD8+RO1CBNnor+1W4alvuOKT6HU=; h=Message-ID:Date:User-Agent:To:From:Subject:From; b=pEKc2RaNLRF2e6t/EfDH9z0+87g7m5CMI66YnqP2hEMa2eqFvDzpCQmEXkgKE5OkT qFSbaR7FFlFb7Hm/cOQw5Syzp5h2P5Fh8kc8Kt270qDWPYKpWA/30srxlVMQ0W4+f0 uax+3GvJrTjxGRDDXBgl4qEFAEelSlB2Uaf4OdFBDzI8zwrOrEVGPC4INSByH+NMgg JbGsPYhm+4tGFtfy+21EF/PnQcrXI4L1ug0tSaboBcYUDYYQqM/n1U60zf2ptS5T7F VzzwRGTAbh2yZxlRVVHEvJJCNzSWgItl2VDNRLNj7NZiuqGm7PzkfqjYL0LDJANy8K 1LbBsCNFec/+Q== Content-Type: multipart/alternative; boundary="------------hoAPHeyt7IzRCRVjzJNNLMjZ" Message-ID: <70f74895-8512-4b2f-8617-2ac0ebcd2e87@postgrespro.ru> Date: Thu, 26 Oct 2023 10:33:50 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: pgsql-docs@lists.postgresql.org From: Maxim Yablokov Subject: Example 43.6. A PL/pgSQL Trigger Function for Maintaining a Summary Table Organization: Postgres Professional 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. --------------hoAPHeyt7IzRCRVjzJNNLMjZ Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hello! 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)? -- Best regards, Maxim Yablokov Technical writer-translator Postgres Professional --------------hoAPHeyt7IzRCRVjzJNNLMjZ Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit

Hello!

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)?

--
Best regards,
Maxim Yablokov
Technical writer-translator
Postgres Professional
--------------hoAPHeyt7IzRCRVjzJNNLMjZ-- From daniel@yesql.se Thu Oct 26 09:29:40 2023 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 1qvwgc-008jIk-PV for pgsql-docs@arkaria.postgresql.org; Thu, 26 Oct 2023 09:29:54 +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 1qvwga-00FBda-DF for pgsql-docs@arkaria.postgresql.org; Thu, 26 Oct 2023 09:29:52 +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 1qvwga-00FBdS-1N for pgsql-docs@lists.postgresql.org; Thu, 26 Oct 2023 09:29:52 +0000 Received: from smtp.outgoing.loopia.se ([93.188.3.37]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qvwgS-002NsJ-6l for pgsql-docs@lists.postgresql.org; Thu, 26 Oct 2023 09:29:50 +0000 Received: from s807.loopia.se (localhost [127.0.0.1]) by s807.loopia.se (Postfix) with ESMTP id 981082FB7CAE for ; Thu, 26 Oct 2023 11:29:41 +0200 (CEST) Received: from s980.loopia.se (unknown [172.22.191.5]) by s807.loopia.se (Postfix) with ESMTP id 88D392E2754B; Thu, 26 Oct 2023 11:29:41 +0200 (CEST) Received: from s898.loopia.se (unknown [172.22.191.6]) by s980.loopia.se (Postfix) with ESMTP id 876F222016B3; Thu, 26 Oct 2023 11:29:41 +0200 (CEST) X-Virus-Scanned: amavisd-new at amavis.loopia.se X-Spam-Flag: NO X-Spam-Score: -1.01 X-Spam-Level: X-Spam-Status: No, score=-1.01 tagged_above=-999 required=6.2 tests=[ALL_TRUSTED=-1, T_SCC_BODY_TEXT_LINE=-0.01] autolearn=disabled Received: from s934.loopia.se ([172.22.191.6]) by s898.loopia.se (s898.loopia.se [172.22.190.17]) (amavisd-new, port 10024) with UTF8LMTP id xUmdNO_ogZQX; Thu, 26 Oct 2023 11:29:41 +0200 (CEST) X-Loopia-Auth: user X-Loopia-User: daniel@yesql.se X-Loopia-Originating-IP: 89.255.232.193 Received: from smtpclient.apple (customer-89-255-232-193.stosn.net [89.255.232.193]) (Authenticated sender: daniel@yesql.se) by s934.loopia.se (Postfix) with ESMTPSA id 07A647CEAD0; Thu, 26 Oct 2023 11:29:41 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.3\)) Subject: Re: Example 43.6. A PL/pgSQL Trigger Function for Maintaining a Summary Table From: Daniel Gustafsson In-Reply-To: <70f74895-8512-4b2f-8617-2ac0ebcd2e87@postgrespro.ru> Date: Thu, 26 Oct 2023 11:29:40 +0200 Cc: pgsql-docs@lists.postgresql.org Content-Transfer-Encoding: quoted-printable Message-Id: <99AC5F34-FDB6-42A8-867A-CF97F0707F9B@yesql.se> References: <70f74895-8512-4b2f-8617-2ac0ebcd2e87@postgrespro.ru> To: Maxim Yablokov X-Mailer: Apple Mail (2.3696.120.41.1.3) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On 26 Oct 2023, at 09:33, Maxim Yablokov = 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 From m.yablokov@postgrespro.ru Thu Oct 26 09:36:02 2023 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 1qvwmh-008k2M-A0 for pgsql-docs@arkaria.postgresql.org; Thu, 26 Oct 2023 09:36:11 +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 1qvwmf-00FEQP-IN for pgsql-docs@arkaria.postgresql.org; Thu, 26 Oct 2023 09:36:09 +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 1qvwmf-00FEQ9-At for pgsql-docs@lists.postgresql.org; Thu, 26 Oct 2023 09:36:09 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by makus.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qvwma-002NuQ-Q7 for pgsql-docs@lists.postgresql.org; Thu, 26 Oct 2023 09:36:08 +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 DFD1AE20E62; Thu, 26 Oct 2023 12:36:02 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mx2023; t=1698312962; bh=P6Mb+Zyi3gdnsOkZmLETkI7JJ9fwk/9oHX8CcPEcc1M=; h=Message-ID:Date:User-Agent:Subject:To:Cc:References:From: In-Reply-To:From; b=ARArCBeI4tcU/h+34UqfH+Z3rMWNpDlug7MDCVLCx03q+ESCI5s5SPocAr3grI3Ok A0LWYmoXdc3ctNRlKOU7FrGLiFT6IiSZtAmDNnau4bFf8EV2DBBAqzlDkbAOSFicSC V/I4yn2tUDzoFrRe+wGSQCnznfEwc4lgPkWFJgd/x0Vll9lu3e5NItyrvZFJKq7PHt 7/A75c2ZxubE7SZbDwOC838zRMxMC2g/cR4job8FK2SDR08lWdGLKzgHjqBP1xcz+f G10Cb8kFJkHP1H6yh5aXou4mkNJxh2CMaNhBGcDGVqKXSwYGNv92Az6r7vX0XnZ5NK qiX0gs9GITGcw== Content-Type: multipart/alternative; boundary="------------VECgGUmeZdVCtZddKAXG4eO1" Message-ID: Date: Thu, 26 Oct 2023 12:36:02 +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. --------------VECgGUmeZdVCtZddKAXG4eO1 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Yeah, sure thing! Thanks! I'll send a patch soon. 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 --------------VECgGUmeZdVCtZddKAXG4eO1 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

Yeah, sure thing! Thanks! I'll send a patch soon.

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
--------------VECgGUmeZdVCtZddKAXG4eO1-- From m.yablokov@postgrespro.ru Thu Oct 26 10:31:07 2023 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-- From daniel@yesql.se Fri Oct 27 13:15:12 2023 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 1qwMgO-00BJRV-Gm for pgsql-docs@arkaria.postgresql.org; Fri, 27 Oct 2023 13:15:24 +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 1qwMgL-00FTjY-Sk for pgsql-docs@arkaria.postgresql.org; Fri, 27 Oct 2023 13:15:21 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qwMgL-00FTjQ-M2 for pgsql-docs@lists.postgresql.org; Fri, 27 Oct 2023 13:15:21 +0000 Received: from smtp.outgoing.loopia.se ([93.188.3.37]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qwMgE-0037Db-Sr for pgsql-docs@lists.postgresql.org; Fri, 27 Oct 2023 13:15:21 +0000 Received: from s807.loopia.se (localhost [127.0.0.1]) by s807.loopia.se (Postfix) with ESMTP id BABBA2FC0A56 for ; Fri, 27 Oct 2023 15:15:13 +0200 (CEST) Received: from s934.loopia.se (unknown [172.22.191.5]) by s807.loopia.se (Postfix) with ESMTP id AB8B62E27619; Fri, 27 Oct 2023 15:15:13 +0200 (CEST) Received: from s470.loopia.se (unknown [172.22.191.5]) by s934.loopia.se (Postfix) with ESMTP id A9E847CEAD4; Fri, 27 Oct 2023 15:15:13 +0200 (CEST) X-Virus-Scanned: amavisd-new at amavis.loopia.se X-Spam-Flag: NO X-Spam-Score: -1 X-Spam-Level: X-Spam-Status: No, score=-1 tagged_above=-999 required=6.2 tests=[ALL_TRUSTED=-1] autolearn=disabled Received: from s981.loopia.se ([172.22.191.5]) by s470.loopia.se (s470.loopia.se [172.22.190.34]) (amavisd-new, port 10024) with UTF8LMTP id oJcvIv0PZCH6; Fri, 27 Oct 2023 15:15:13 +0200 (CEST) X-Loopia-Auth: user X-Loopia-User: daniel@yesql.se X-Loopia-Originating-IP: 89.255.232.193 Received: from smtpclient.apple (customer-89-255-232-193.stosn.net [89.255.232.193]) (Authenticated sender: daniel@yesql.se) by s981.loopia.se (Postfix) with ESMTPSA id 591D122B168C; Fri, 27 Oct 2023 15:15:13 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.3\)) Subject: Re: Example 43.6. A PL/pgSQL Trigger Function for Maintaining a Summary Table From: Daniel Gustafsson In-Reply-To: Date: Fri, 27 Oct 2023 15:15:12 +0200 Cc: pgsql-docs@lists.postgresql.org Content-Transfer-Encoding: quoted-printable Message-Id: <455CCA8F-4D66-48A1-A6B8-07371D97B4D5@yesql.se> References: <70f74895-8512-4b2f-8617-2ac0ebcd2e87@postgrespro.ru> <99AC5F34-FDB6-42A8-867A-CF97F0707F9B@yesql.se> To: Maxim Yablokov X-Mailer: Apple Mail (2.3696.120.41.1.3) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On 26 Oct 2023, at 12:31, Maxim Yablokov = wrote: >=20 > I believe that the attached patch should fix this problem. Please have = a look. Thanks, I'll await pushing and backpatching if Tom who committed it has insights into whether it was missed or if it indeed serves a purpose. = If not I think it should be backpatched all the way since it exists for all = supported versions. -- Daniel Gustafsson From tgl@sss.pgh.pa.us Sat Oct 28 02:16:54 2023 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 1qwYsr-00ChIk-Vf for pgsql-docs@arkaria.postgresql.org; Sat, 28 Oct 2023 02:17:05 +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 1qwYso-002hRd-Lr for pgsql-docs@arkaria.postgresql.org; Sat, 28 Oct 2023 02:17:02 +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 1qwYso-002hRI-Eb for pgsql-docs@lists.postgresql.org; Sat, 28 Oct 2023 02:17:02 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qwYsi-002f7j-8P for pgsql-docs@lists.postgresql.org; Sat, 28 Oct 2023 02:17:01 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 39S2Gstj1688334; Fri, 27 Oct 2023 22:16:55 -0400 From: Tom Lane To: Daniel Gustafsson cc: Maxim Yablokov , pgsql-docs@lists.postgresql.org Subject: Re: Example 43.6. A PL/pgSQL Trigger Function for Maintaining a Summary Table In-reply-to: <455CCA8F-4D66-48A1-A6B8-07371D97B4D5@yesql.se> References: <70f74895-8512-4b2f-8617-2ac0ebcd2e87@postgrespro.ru> <99AC5F34-FDB6-42A8-867A-CF97F0707F9B@yesql.se> <455CCA8F-4D66-48A1-A6B8-07371D97B4D5@yesql.se> Comments: In-reply-to Daniel Gustafsson message dated "Fri, 27 Oct 2023 15:15:12 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1688332.1698459414.1@sss.pgh.pa.us> Date: Fri, 27 Oct 2023 22:16:54 -0400 Message-ID: <1688333.1698459414@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Daniel Gustafsson writes: > Thanks, I'll await pushing and backpatching if Tom who committed it has > insights into whether it was missed or if it indeed serves a purpose. Hey, I just pushed that for somebody else, I don't claim authorship ;-) It seems clear that the example intends to show a star-schema database where the fact table refers to various dimension tables. But it's incomplete --- there's no foreign-key constraint on time_key, and even less infrastructure for product_key or store_key. I don't have the cited book either, so I don't know how complete the original example was. Perhaps the bit in the trigger function about forbidding updates to time_key has something to do with that model. Anyway, I don't see any reason to object to this patch. The extra table isn't adding much. My only thought is would it make sense to change time_key to be a timestamp or timestamptz value? regards, tom lane