protected function buildComments()
    {

        if( is_null( $this->comments ) ) {
            $this->comments = array();
        } else {
            return;
        }

        $sql = <<<SQL
SELECT
    a.attrelid::text || '.' || a.attnum AS key,
    d.description AS text
FROM
    pg_attribute AS a
INNER JOIN
    pg_description AS d ON
        a.attrelid = d.objoid AND
        a.attnum = d.objsubid AND
        d.classoid = 'pg_class'::regclass::oid
WHERE
    a.attnum > 0
;
SQL
;

        $comments = $this->db->query( new Query( $sql ) )->fetch();

        // key the array and populate static cache
        foreach( $comments as $comment ) {
            $this->comments[$comment['key']] = $comment['text'];
        }

    }
protected function buildComments()
    {

        if( is_null( $this->comments ) ) {
            $this->comments = array();
        } else {
            return;
        }

        $sql = <<<SQL
SELECT
    a.attrelid::text || '.' || a.attnum AS key,
    d.description AS text
FROM
    pg_attribute AS a
INNER JOIN
    pg_description AS d ON
        a.attrelid = d.objoid AND
        a.attnum = d.objsubid AND
        d.classoid = 'pg_class'::regclass::oid
WHERE
    a.attnum > 0
;
SQL
;

        $comments = $this->db->query( new Query( $sql ) )->fetch();

        // key the array and populate static cache
        foreach( $comments as $comment ) {
            $this->comments[$comment['key']] = $comment['text'];
        }

    }
protected function buildComments ( ) { if ( is_null ( $ this -> comments ) ) { $ this -> comments = array ( ) ; } else { return ; } $ sql =  <<<SQL
SELECT
    a.attrelid::text || '.' || a.attnum AS key,
    d.description AS text
FROM
    pg_attribute AS a
INNER JOIN
    pg_description AS d ON
        a.attrelid = d.objoid AND
        a.attnum = d.objsubid AND
        d.classoid = 'pg_class'::regclass::oid
WHERE
    a.attnum > 0
;
SQL ; $ comments = $ this -> db -> query ( new Query ( $ sql ) ) -> fetch ( ) ; // key the array and populate static cache foreach ( $ comments as $ comment ) { $ this -> comments [ $ comment [ 'key' ] ] = $ comment [ 'text' ] ; } }
It's a hassle complicating all the column source queries with a join to pg_description.
This is a lazy load comment solution. Midly hacky.
It s a hassle complicating all the column source queries with a join to pg_description . This is a lazy load comment solution . Midly hacky .