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 1srbsd-003CKE-OR for pgsql-general@arkaria.postgresql.org; Fri, 20 Sep 2024 11:32:56 +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 1srbsb-0044vA-Ol for pgsql-general@arkaria.postgresql.org; Fri, 20 Sep 2024 11:32:55 +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 1srbsb-0044v2-E9 for pgsql-general@lists.postgresql.org; Fri, 20 Sep 2024 11:32:54 +0000 Received: from forward100b.mail.yandex.net ([178.154.239.147]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1srbsY-000AEe-TW for pgsql-general@postgresql.org; Fri, 20 Sep 2024 11:32:53 +0000 Received: from mail-nwsmtp-smtp-production-main-63.sas.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-63.sas.yp-c.yandex.net [IPv6:2a02:6b8:c08:1699:0:640:fad2:0]) by forward100b.mail.yandex.net (Yandex) with ESMTPS id A81E460D02 for ; Fri, 20 Sep 2024 14:32:47 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-63.sas.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id kWNddMAoNCg0-H1TQCoO1; Fri, 20 Sep 2024 14:32:47 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ya.ru; s=mail; t=1726831967; bh=eS/CRlU+EQ81+q+qjkaFUQQMUvkOwXDGoKFzBzEuFoM=; h=To:Subject:From:Date:Message-ID; b=XFHnV9UxUiJxTP2GhI5U/G+eQDk11Yh8dlTbrwC2M2tfQ/uhWExdmxM08Dq7pMeGF bhOZmJVh9UNEtalxOcfvEDi/gedY+q/TWYZIF3JUDzpWacEJClCLr4nhAYC8Qe+kMQ 4M2BozYenauCr9gH+s1zOm0SYU1Yb9/cXnbZ9M70= Authentication-Results: mail-nwsmtp-smtp-production-main-63.sas.yp-c.yandex.net; dkim=pass header.i=@ya.ru Message-ID: Date: Fri, 20 Sep 2024 14:32:48 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Olleg Subject: Dependencies on the system view To: pgsql-general@postgresql.org Content-Language: ru, en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi all. One of our programmer created a view based on the system view. I tried to explain him, that he created a dependency from the ordinary database to the system object and this is a bad idea. But he is not smart enough. So I need a guru opinion. Is this permissible or here will be a troubles with, for instance, pg_upgrade? CREATE OR REPLACE VIEW public.all_tables AS SELECT n.nspname AS schemaname, c.relname AS tablename, pg_get_userbyid(c.relowner) AS tableowner, c.reltuples AS num_rows, c.relkind, CASE c.relkind WHEN 'f'::"char" THEN 'Foreign table'::text WHEN 'r'::"char" THEN 'Relation'::text WHEN 'i'::"char" THEN 'Index'::text WHEN 'S'::"char" THEN 'Sequence'::text WHEN 't'::"char" THEN 'TOAST'::text WHEN 'v'::"char" THEN 'View'::text WHEN 'm'::"char" THEN 'Materialized view'::text WHEN 'c'::"char" THEN 'Composite type'::text WHEN 'p'::"char" THEN 'Partitioned table'::text WHEN 'I'::"char" THEN 'partitioned Index'::text ELSE NULL::text END AS rel_type, c.relpersistence, CASE c.relpersistence WHEN 'p'::"char" THEN 'permanent'::text WHEN 'u'::"char" THEN 'unlogged'::text WHEN 't'::"char" THEN 'temporary'::text WHEN 'c'::"char" THEN 'constant'::text ELSE NULL::text END AS persistence, t.spcname AS tablespace, c.relhasindex AS hasindexes, c.relhasrules AS hasrules, c.relhastriggers AS hastriggers FROM pg_class c LEFT JOIN pg_namespace n ON n.oid = c.relnamespace LEFT JOIN pg_tablespace t ON t.oid = c.reltablespace; -- Olleg