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.98.2) (envelope-from ) id 1xGcs5-00000002WTZ-1M1H for pgsql-general@arkaria.postgresql.org; Tue, 13 Oct 2026 13:48:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xGcr3-0000000EJvM-3DlZ for pgsql-general@arkaria.postgresql.org; Tue, 13 Oct 2026 13:47:45 +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.98.2) (envelope-from ) id 1xGcr3-0000000EJvD-1fil for pgsql-general@lists.postgresql.org; Tue, 13 Oct 2026 13:47:45 +0000 Received: from mail-ed1-x52f.google.com ([2a00:1450:4864:20::52f]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1xGcr0-00000001sce-3uQW for pgsql-general@postgresql.org; Tue, 13 Oct 2026 13:47:44 +0000 Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-6b1ec41d8e9so798979a12.0 for ; Tue, 13 Oct 2026 06:47:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1791899262; x=1792504062; darn=postgresql.org; h=mime-version:user-agent:content-transfer-encoding:content-type :references:in-reply-to:date:cc:to:from:subject:message-id:from:to :cc:subject:date:message-id:reply-to:content-type; bh=KoJoVE3fmJLHR3BksHmX/4H7jmPxSUnWWDoIYzdWdG0=; b=JJfcZUYhVDdHQypW297GQIrYmLZL7J6zP4sTvleKsbBK9JS3dd6XraDTWIlomSU0QA 000pwRENz6gGYd+pOFy2xtR3rqarhnWaF5Xk58wqMF6gvLLbCSqetmiHTTRqVN0gdcVV ZpqtzGvUXb63hyxBNY9a7bPpBpdzbEc2hAU2/AsefL1P4nj2K8fbiOhzYuGPQqjeKEcJ +QnF2zaeeJFrgsVsXyV8ZMw+pL/PnRwFvWI/Q/FQ0VCp+K2k2uKgY4QwgUjt79HlceUD 7bfT55BS1aC5W+46ozF5ejHSelN8l2PoVEKaPCZadEMepqAn0BEutIGEIYAhVw+7fplE hmbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1791899262; x=1792504062; h=mime-version:user-agent:content-transfer-encoding:content-type :references:in-reply-to:date:cc:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=KoJoVE3fmJLHR3BksHmX/4H7jmPxSUnWWDoIYzdWdG0=; b=OOWCD2XdWhr389f6xm2bPwTRms9lnkSeXbKjiNXub0j+7RROPQkgsKpmzI8g0cEtEd 8sMMvDdREGbkRvkmIATrP389zfG4euFqmzL9pRarT2GJekvAqOf+pgQf9WjLgvV7IwJ4 SjEyn6DW2cgBQcT1pGJJ7FXs/Ujy7zB7XZ+SptHVmENR+zPTncaeP/aNmQyMgKfKutfc Seqw4nNIEzRkgY9lAZo0MNbmEPWCXdlI9YDO4xqQiyfIqTFAOOGeKvF6QRrJNzGk1uFw xip8MPzejCZZETwB8W5NU/EV4SMi8sYFxJ8f3EY08C30D0BDj1I8VccnViRuR3PTRByC f+PQ== X-Forwarded-Encrypted: i=1; AKwUvBzBpu+x4luJlKc1wdcGiJ2Mtgb2oRztrXpoQGDisoEfn/FcWbIpq15S+938PxUIUhbzc0ntEdqcxnW6cyok@postgresql.org X-Gm-Message-State: AFq9FYIM2p3nu1V53Vt1awmWgSu8xGFuhPbx8yvdxr38yjrgdJJor7KQ bVpCssj9P27LPJJYXY1qWgS/ppI276bxLRo6+jc/6n+/H0+VVbL2ZX4bCkzk7ml+f8U= X-Gm-Gg: AYBFou0zgrfSUB2p0l/V+nr9JpsZYBoOA8VPwjTZd6oxRAUhqZ8hVhWqtloT/kaddqL FjTxHeOL+vYbVnvE4ogR5LRS6XtaOThmu7Ak6hRFTqLFqVGBZlKWpB9yu89h7Q4krRBv2gK3pDm Bpgw4LzXRz7YIEHzQwhhIx+j26saaKaNB3q5daBhkPvjBvKiJ9V4p7uml/W++GFRMXxevdvlHLB TojXzUm3je49SMhjy67dAaOHI1C8WU8dS05WNfALOI8ieJ1dL5ZUCUcsMJxeB3Zu7Vkxx6Z6L9P KtlNIEB8caf7c5OemhcrY96IfHCptqEjRgmYxhw6WuV00F+oiKwy+iC48N2FQNwM6b85u9DzfBW dFio1JGQza0WbQd60eiwH6ErRb0h+gM217QJwHPXHpLwOpvgXCueXS0EUiyB8EoqRyRT9TYf6Zs s6abq7RJ42r8nTtoYfOhvReHBs+WK0TrxH8yfh+WchIShBRbOOVe0AFO02wnjRJq7YndgEZi/xA iIlPRjvk4usADxIm87XFHlN2A== X-Received: by 2002:a17:907:6e89:b0:c2e:4652:852f with SMTP id a640c23a62f3a-c31aa0e17edmr1196766766b.47.1791899261922; Tue, 13 Oct 2026 06:47:41 -0700 (PDT) Received: from laurenz.albe-K4N0CV00F97414D ([2001:871:70:a6bb:bf5f:4d69:766:a65]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c31b9a2e2b3sm549851666b.52.2026.10.13.06.47.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Oct 2026 06:47:41 -0700 (PDT) Message-ID: Subject: Re: AW: Why is materialized view creation a "security-restricted operation"? From: Laurenz Albe To: =?ISO-8859-1?Q?F=E4rber=2C?= "Franz-Josef (StMUK)" , Adrian Klaver , "pgsql-general@postgresql.org" Cc: "Haupt, Matthias (StMUK)" Date: Tue, 13 Oct 2026 15:47:40 +0200 In-Reply-To: <5628a96712e14b9fac594b34b0eb9161@stmuk.bayern.de> References: <77826d7580a9488ca28eb4bcfe94aa37@stmuk.bayern.de> <2e9d29c1513afb47d652387ea5299076ef24adce.camel@cybertec.at> <4d7467aa0ee958343fca8c6bd6720952b5bc08b1.camel@cybertec.at> <5628a96712e14b9fac594b34b0eb9161@stmuk.bayern.de> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.60.2 (3.60.2-2.fc44) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, 2026-10-13 at 11:36 +0000, F=C3=A4rber, Franz-Josef (StMUK) wrote: > > > [rant about PostgreSQL security restrictions] > > No no no, not about security restrictions. The rant is about lacking orth= ogonality. > About often NOT being able to combine language features. Doesn't anybody = share that > view? We COULD do better, I think. Well, you want to use a materialized view for something that it cannot be u= sed for, for security reasons. We tried to explain that in this thread. > > If the security restrictions of materialized views prevent you from usi= ng them, > > why don't you use a normal table instead, TRUNCATE it and INSERT into i= t? > > The MAT VIEW is used from "outside". From other views, or from a client t= hat connects to the database. >=20 > * I can replace it with a view; I didn't do that for performance reasons. > * I can replace it with a persistent table, a stored procedure, and custo= m caching > logic. That'll work. But this is what a MAT VIEW is for, I thought.=20 You could write a procedure that truncates the table and populates it with a query, using a temporary table if you want. Calling that procedure is ju= st as convenient as calling REFRESH MATERIALIZED VIEW. Are you searching for a usable solution for a problem? Then that should do= . Yours, Laurenz Albe