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 1srbs3-003CFR-JD for pgsql-general@arkaria.postgresql.org; Fri, 20 Sep 2024 11:32:20 +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 1srbs1-0041X1-HJ for pgsql-general@arkaria.postgresql.org; Fri, 20 Sep 2024 11:32:18 +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 1srbs1-0041Vc-1D for pgsql-general@lists.postgresql.org; Fri, 20 Sep 2024 11:32:18 +0000 Received: from forward101d.mail.yandex.net ([178.154.239.212]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1srbry-000ArM-7N for pgsql-general@postgresql.org; Fri, 20 Sep 2024 11:32:17 +0000 Received: from mail-nwsmtp-smtp-production-main-24.klg.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-24.klg.yp-c.yandex.net [IPv6:2a02:6b8:c42:2d4c:0:640:de18:0]) by forward101d.mail.yandex.net (Yandex) with ESMTPS id 7957460B37 for ; Fri, 20 Sep 2024 14:32:14 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-24.klg.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id DWNUn57Ff8c0-KBgp7Xst; Fri, 20 Sep 2024 14:32:14 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ya.ru; s=mail; t=1726831934; bh=6c2jcT3w97WNv+geki57tu25/VCqSeODdwMMie32x+M=; h=Subject:From:To:Date:Message-ID; b=GPq5bEML+uT9D4zTd0vP3Cnw8PX7Pmaw6/enjTjZpX6VB3NZoWaZNUgS3x3xWq1v2 JGOJdpo/U0J2W1qTCXvJwgEuIIUt9L+1sX0Y7nhc+9nSN2+7Cmbd0vMjCpciXI4gV+ 50YsElRqsE5Ti/Y7tM+6Cx3HeF/dabh2GaIA94F8= Authentication-Results: mail-nwsmtp-smtp-production-main-24.klg.yp-c.yandex.net; dkim=pass header.i=@ya.ru Message-ID: <5ad41b52-865b-48cc-87cf-7c7ed9e2e978@ya.ru> Date: Fri, 20 Sep 2024 14:32:14 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: pgsql-general@postgresql.org Content-Language: ru, en-US From: Olleg Subject: Dependencies on the system view 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 will here be a trouble 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