Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1krrhA-00039N-CV for pgsql-general@arkaria.postgresql.org; Wed, 23 Dec 2020 00:08:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1krrh8-0003tg-3E for pgsql-general@arkaria.postgresql.org; Wed, 23 Dec 2020 00:07:58 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1krrh6-0003tY-N6 for pgsql-general@lists.postgresql.org; Wed, 23 Dec 2020 00:07:57 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1krrgx-00054A-KL for pgsql-general@postgresql.org; Wed, 23 Dec 2020 00:07:55 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 8507C5C0081 for ; Tue, 22 Dec 2020 19:07:45 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Tue, 22 Dec 2020 19:07:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= to:from:subject:message-id:date:mime-version:content-type :content-transfer-encoding; s=fm1; bh=gGPeHTc+TMt2QdF1H8ypQWnBLo A5ywKwcm6OOvcKYNM=; b=ERaAIWP2S891Bu3T6WALMNRJwF8zupVQYx5Qriqgza Q9cQScIHI5at63mxH4+S2jKTNNvu+lkdnk9REXCIEwASOiHshozbjI04eF3nQJuQ ciuEruAL0+bpYGNrcnGgrhbiemP3PzTISRoQNb0ES9HvXAbNlNnwKW/qn0NgMHI6 v9Q/claJW58yowFWOFTx5cUb2gaGARkZf+ZfJjMo7V7Edec24CphIJvhAM1yHCj3 vU42pPqaW4v3HvaichHBbazf6KRVSEKD812m4dWqFaXTI7u9NRCbBRzP6DtFCrn0 EF9dJa3kD5Zo8mN9tINNtl1ldGSb2cGS9uarGfNO6Nog== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=gGPeHT c+TMt2QdF1H8ypQWnBLoA5ywKwcm6OOvcKYNM=; b=YJYEikaUMakvSqqM3UGJVX BEZlC/X3dGiUWz0p5cHvrLdS1WebZIreXre7Alc6MlQSqIimL8pVrBRuQB3L9tF0 IrafHvVRWE6HqO/lUrZdbmp/tYxsxqkWAznMuMfj7ZM8knWpUnVd0ZAB9vpezTPf Mxuz8XjZ30OE7M+N5xrNfnHlFsobIw3FIsUa/xJ1JqVQEMA8JRe+Tfme4nOhVcCN ELyFeNTXSikLMZ4YKPhbNvQD/lJxkwV9WEzjPB9zP5hfVhdK3w+eoAQrPM/rexEE P39YSE5GIoDTfihLermtjAn3DhnX2yHiOfIFU54EDecvWlV4Z/PPbv4a8gpQmJ8g == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrvddthedgudelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefvhffukffffgggtgfgsehtjeertd dtfeejnecuhfhrohhmpeetughrihgrnhcumfhlrghvvghruceorggurhhirghnrdhklhgr vhgvrhesrghklhgrvhgvrhdrtghomheqnecuggftrfgrthhtvghrnheptddvhffhhfekle etgeduhfelfeegueejkeegleekudekvddvveeifeegjeduhfelnecuffhomhgrihhnpehs thgrtghkohhvvghrfhhlohifrdgtohhmnecukfhppeejhedrudejvddrudegrddujeenuc evlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgr nhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhm X-ME-Proxy: Received: from [192.168.1.4] (75-172-14-17.tukw.qwest.net [75.172.14.17]) by mail.messagingengine.com (Postfix) with ESMTPA id EB20924005C for ; Tue, 22 Dec 2020 19:07:44 -0500 (EST) To: pgsql-general From: Adrian Klaver Subject: Information schema sql_identifier Message-ID: <653c81a9-bc2b-e7a6-1ece-eab59f007400@aklaver.com> Date: Tue, 22 Dec 2020 16:07:44 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Per version 12 release notes: "Treat object-name columns in the information_schema views as being of type name, not varchar (Tom Lane) Per the SQL standard, object-name columns in the information_schema views are declared as being of domain type sql_identifier. In PostgreSQL, the underlying catalog columns are really of type name. This change makes sql_identifier be a domain over name, rather than varchar as before. ..." This came up in this SO question: https://stackoverflow.com/questions/65416748/postgres-12-4-gives-function-does-not-exists-error Where the query is: SELECT (TABLE_SCHEMA || '"."' || TABLE_NAME) as table_name, pg_size_pretty(pg_table_size(table_name)) as table_size, pg_size_pretty(pg_indexes_size(table_name)) AS indexes_size, pg_size_pretty(pg_total_relation_size(table_name)) as total_size from information_schema.TABLES nowait where TABLE_SCHEMA='myschema' order by pg_total_relation_size(table_name) desc; And the error is: "ERROR: function pg_table_size(information_schema.sql_identifier) does not exist LINE 1: ..."."' || TABLE_NAME) as table_name, pg_size_pretty(pg_table_s..." My attempts: SELECT pg_table_size(table_name) from information_schema.tables; ERROR: function pg_table_size(information_schema.sql_identifier) does not exist LINE 1: SELECT pg_table_size(table_name) from information_schema.ta... SELECT pg_table_size(table_name::text) from information_schema.tables; ERROR: invalid name syntax SELECT pg_table_size(table_name::regclass) from information_schema.tables; ERROR: invalid name syntax SELECT table_name::text::regclass from information_schema.tables; ERROR: invalid name syntax So how does one go about using a table name from information_schema.tables in pg_table_size()? -- Adrian Klaver adrian.klaver@aklaver.com