Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

devondahon's avatar

Query PostgreSQL pg_catalog.pg_statio_all_tables using Query Builder ?

How to convert this query to Query Builder syntax ?

        SELECT
         c.ordinal_position,
         c.table_schema,
         c.table_name,
         c.column_name,
         pgd.description,
         c.udt_name as udt_name

        FROM pg_catalog.pg_statio_all_tables as st

        LEFT JOIN information_schema.columns as c
        ON c.table_schema=st.schemaname and c.table_name=st.relname

        LEFT JOIN pg_catalog.pg_description as pgd
        ON pgd.objsubid=c.ordinal_position and  pgd.objoid=st.relid

        WHERE
         st.schemaname NOT IN ('pg_catalog', 'information_schema');
0 likes
3 replies
sr57's avatar
\DB::statement("your_sql");
devondahon's avatar

@sr57 It seems to work, but how can I get the result of such query ? Currently, it's just returning true.

Please or to participate in this conversation.