Re: Information schema sql_identifier - Mailing list pgsql-general

From David G. Johnston
Subject Re: Information schema sql_identifier
Date
Msg-id CAKFQuwbu2cHBEEyS_NBhXFouXAjPcMzG3iw5q7iJqudCaA+GQQ@mail.gmail.com
Whole thread Raw
In response to Information schema sql_identifier  (Adrian Klaver <adrian.klaver@aklaver.com>)
Responses Re: Information schema sql_identifier  (Adrian Klaver <adrian.klaver@aklaver.com>)
List pgsql-general
On Tue, Dec 22, 2020 at 5:08 PM Adrian Klaver <adrian.klaver@aklaver.com> wrote:
SELECT pg_table_size(table_name::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()?

Find that the function signature in the documentation requires an input of "regclass" and ignore attempts to pass anything but that to the function.

pg_table_size ( regclass ) → bigint

I observe in v13 that the expected syntax works just fine:

select pg_table_size((table_schema || '.' || table_name)::regclass) from information_schema.tables;

David J.

pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Information schema sql_identifier
Next
From: Tom Lane
Date:
Subject: Re: Information schema sql_identifier