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 1rEqMB-007FOm-BN for pgsql-bugs@arkaria.postgresql.org; Sun, 17 Dec 2023 12:34:55 +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 1rEqL9-000qUh-Qp for pgsql-bugs@arkaria.postgresql.org; Sun, 17 Dec 2023 12:33:51 +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 1rEqL9-000qUZ-GA for pgsql-bugs@lists.postgresql.org; Sun, 17 Dec 2023 12:33:51 +0000 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rEqL2-00CSNI-Ca for pgsql-bugs@lists.postgresql.org; Sun, 17 Dec 2023 12:33:50 +0000 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-40c60dfa5bfso26782525e9.0 for ; Sun, 17 Dec 2023 04:33:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702816422; x=1703421222; darn=lists.postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=TSxmwEd8Oi844Qgh1z/5CTV3yruG02SePQzjoRZrD0A=; b=YD+KhFsjEzuhluJoshI8R6K6QjG9LDs/O82lH7ocjemKu45aM1Qs2dv0OFMK3F4d6Z k5fwyBNKYB/r/d/xFNf0mZimKb5ohXnZpQDUM0D9427yKcY/J4M/T3aZ2NV3McQa6dm2 c+jf9fqRqtlVufMIFcDNnv4/4ZpXlB9BmyIu6ho+uOfa8LGpBz56eOzXOHyOs2M6KMGl NDvJiVWjP77quo6lVbw46T6S6Nvqy5fvgXx9c9tlIgV9lqk7ADoBcsOxlOycvFBNQF07 zwTTOallTa6bzy3dm/HsP3Qf0uvjAbsuzWMIerMHpbi0gZ9u/59WdloheFvRXIQTv/W0 FBVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702816422; x=1703421222; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=TSxmwEd8Oi844Qgh1z/5CTV3yruG02SePQzjoRZrD0A=; b=cSUuAnLzlZxCd5RJbP87bj/DS9PXBfXYWYWCkXsvjQ+ZBjYdOoVtoaLmJ/N8vEcmKq 0r5mHJctiDtRAraYEhfqlAXDy1OWK3BYwvLEZwcLj1AUlilTZdef1tZm1W1oklyiPNLw TC5KyGX5NP6vtRfEZnpy0Vk22iVaH738jfRbn2cRLKvxyyqmi8jjrRjrmgrCjpwxVHdu y+odxLZmajq/MA4NKqkeKmVK/MjoIYOQ7Mg7Os5Oc0lpzU7OsgSbO8+pwFI6OR1ToBvo KrEIQfJm7fm/cw7a7Keg0y8cpiJ7Xstakei9uQ8WkiO2jhDJvclJIrZGdK//BVBHYLZu DcZQ== X-Gm-Message-State: AOJu0Yw6A5az9+5j0TTD1+bvQTKzeTTvsaDtyZZnfYK+AwL9sp87qyDM 7pkS9/0kPnVC2zKnkoBCw0Q= X-Google-Smtp-Source: AGHT+IEKkBAo9bmo3h7FQtF77n2GWJwMi6iaAGuVYNstNxSQnoBS3r5SuTWIN834JAVkpxvOENM6nQ== X-Received: by 2002:a05:600c:a01c:b0:40c:7043:63cc with SMTP id jg28-20020a05600ca01c00b0040c704363ccmr1389020wmb.101.1702816421984; Sun, 17 Dec 2023 04:33:41 -0800 (PST) Received: from jrouhaud ([2a01:e0a:c:bcf0:ec85:ea3:ccb3:c8b3]) by smtp.gmail.com with ESMTPSA id n18-20020a05600c501200b0040b37f1079dsm40220546wmr.29.2023.12.17.04.33.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Dec 2023 04:33:41 -0800 (PST) Date: Sun, 17 Dec 2023 13:33:40 +0100 From: Julien Rouhaud To: vardan.pogosyn@yandex.ru, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18251: Incorrect DROP VIEW pg_catalog.* behavior Message-ID: References: <18251-1f41c42bb11eace0@postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <18251-1f41c42bb11eace0@postgresql.org> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On Sun, Dec 17, 2023 at 09:44:33AM +0000, PG Bug reporting form wrote: > > When i try to drop and create system view, i get following behavior: > > postgres=# DROP VIEW pg_catalog.pg_config; > DROP VIEW > > postgres=# CREATE OR REPLACE VIEW pg_catalog.pg_config AS > SELECT pg_config.name, pg_config.setting > FROM pg_config() pg_config(name, setting); > ERROR: permission denied to create "pg_catalog.pg_config" > DETAIL: System catalog modifications are currently disallowed. That's somewhat expected. System catalog modifications are only prevented globally at the creation side, I guess mostly because we don't want user to e.g. create an index or a trigger on a system catalog just to realize that it won't be maintained, and things like that. The fact that you can drop a system view is because you're using a superuser connection, and there are so many things you can do as a superuser to mess up the instance so there wouldn't be much value disallowing just this specific case. > > I'm not sure, but it's look strange. > When i connect to template1, i can use droped views. But if drop view on > template1 problem repeats. That's not surprising. You always need to use a database to create a new one. The only different between a template database and a normal database is the permissions needed on the source database side.