Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gbLA9-0001wK-Qe for pgsql-general@arkaria.postgresql.org; Mon, 24 Dec 2018 08:00:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gbL98-0004M2-Nr for pgsql-general@arkaria.postgresql.org; Mon, 24 Dec 2018 07:59:30 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gbL98-0004Lu-Bl for pgsql-general@lists.postgresql.org; Mon, 24 Dec 2018 07:59:30 +0000 Received: from [195.159.176.226] (helo=blaine.gmane.org) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gbL95-0007TM-7b for pgsql-general@postgresql.org; Mon, 24 Dec 2018 07:59:28 +0000 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1gbL6u-00084u-EB for pgsql-general@postgresql.org; Mon, 24 Dec 2018 08:57:12 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-general@postgresql.org From: George Neuner Subject: Re: Watching for view changes Date: Mon, 24 Dec 2018 02:59:16 -0500 Lines: 19 Message-ID: References: <1iho1ehdf227kvm7p6vn11hg11jf19i8iv@4ax.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@blaine.gmane.org User-Agent: ForteAgent/8.00.32.1272 X-Antivirus: Avast (VPS 181223-4, 12/23/2018), Outbound message X-Antivirus-Status: Clean X-Host-Lookup-Failed: Reverse DNS lookup failed for 195.159.176.226 (failed) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Sun, 23 Dec 2018 23:06:51 -0800, Mitar wrote: >On Fri, Dec 21, 2018 at 11:10 PM George Neuner wrote: >> A materialized view IS exactly such a deliberate cache of results from >> applying a view. It is a real table that can be monitored for changes >> using INSERT, UPDATE and/or DELETE triggers. > >Are you sure one can use triggers on a materialized view? I am getting: > >"my_materialized_view" is not a table or view > >as an error when I am trying to create a trigger on materialized view. IIRC the cache table's name is generated. I don't know the proper incantations to get it from the catalogs, but an easy way to find it is to put the materialized view into its own tablespace, then search pg_tables for objects in that space. George