Here&#x27;s a jOOQ example from the &quot;PostgresDatabase&quot; class, which is used to reverse-engineer the meta data. How would you write it in Torque?<p><pre><code>    .select()
    .from(
         select(
            TABLES.TABLE_SCHEMA,
            TABLES.TABLE_NAME,
            TABLES.TABLE_NAME.as(&quot;specific_name&quot;),
            inline(false).as(&quot;table_valued_function&quot;),
            inline(false).as(&quot;materialized_view&quot;),
            PG_DESCRIPTION.DESCRIPTION)
        .from(TABLES)
        .join(PG_NAMESPACE)
            .on(TABLES.TABLE_SCHEMA.eq(PG_NAMESPACE.NSPNAME))
        .join(PG_CLASS)
            .on(PG_CLASS.RELNAME.eq(TABLES.TABLE_NAME))
            .and(PG_CLASS.RELNAMESPACE.eq(oid(PG_NAMESPACE)))
        .leftOuterJoin(PG_DESCRIPTION)
            .on(PG_DESCRIPTION.OBJOID.eq(oid(PG_CLASS)))
            .and(PG_DESCRIPTION.OBJSUBID.eq(0))
        .where(TABLES.TABLE_SCHEMA.in(getInputSchemata()))
    
        &#x2F;&#x2F; To stay on the safe side, if the INFORMATION_SCHEMA ever
        &#x2F;&#x2F; includs materialised views, let&#x27;s exclude them from here
        .and(row(TABLES.TABLE_SCHEMA, TABLES.TABLE_NAME).notIn(
            select(
                PG_NAMESPACE.NSPNAME,
                PG_CLASS.RELNAME)
            .from(PG_CLASS)
            .join(PG_NAMESPACE)
                .on(PG_CLASS.RELNAMESPACE.eq(oid(PG_NAMESPACE)))
            .where(PG_CLASS.RELKIND.eq(inline(&quot;m&quot;)))
        ))
    
    &#x2F;&#x2F; [#3254] Materialised views are reported only in PG_CLASS, not
    &#x2F;&#x2F;         in INFORMATION_SCHEMA.TABLES
    .unionAll(
        select(
            PG_NAMESPACE.NSPNAME,
            PG_CLASS.RELNAME,
            PG_CLASS.RELNAME,
            inline(false).as(&quot;table_valued_function&quot;),
            inline(true).as(&quot;materialized_view&quot;),
            PG_DESCRIPTION.DESCRIPTION)
        .from(PG_CLASS)
        .join(PG_NAMESPACE)
            .on(PG_CLASS.RELNAMESPACE.eq(oid(PG_NAMESPACE)))
        .leftOuterJoin(PG_DESCRIPTION)
            .on(PG_DESCRIPTION.OBJOID.eq(oid(PG_CLASS)))
            .and(PG_DESCRIPTION.OBJSUBID.eq(0))
        .where(PG_NAMESPACE.NSPNAME.in(getInputSchemata()))
        .and(PG_CLASS.RELKIND.eq(inline(&quot;m&quot;))))
    
    &#x2F;&#x2F; [#3375] [#3376] Include table-valued functions in the set of tables
    .unionAll(
        tableValuedFunctions()
    
        ?   select(
                ROUTINES.ROUTINE_SCHEMA,
                ROUTINES.ROUTINE_NAME,
                ROUTINES.SPECIFIC_NAME,
                inline(true).as(&quot;table_valued_function&quot;),
                inline(false).as(&quot;materialized_view&quot;),
                inline(&quot;&quot;))
            .from(ROUTINES)
            .join(PG_NAMESPACE).on(ROUTINES.SPECIFIC_SCHEMA.eq(PG_NAMESPACE.NSPNAME))
            .join(PG_PROC).on(PG_PROC.PRONAMESPACE.eq(oid(PG_NAMESPACE)))
                          .and(PG_PROC.PRONAME.concat(&quot;_&quot;).concat(oid(PG_PROC)).eq(ROUTINES.SPECIFIC_NAME))
            .where(ROUTINES.ROUTINE_SCHEMA.in(getInputSchemata()))
            .and(PG_PROC.PRORETSET)
    
        :   empty)
    .asTable(&quot;tables&quot;))
    .orderBy(1, 2)
    .fetch()) {</code></pre>