Postgresql regexp_matches inside view always returns null when queried from PHP

后端 未结 3 1195
眼角桃花
眼角桃花 2020-12-22 12:21

I have view similar to this one

CREATE OR REPLACE VIEW regexp_test AS (
    SELECT regexp_matches(decode(\'NTB4\', \'base64\')::text, \'(\\d+)x\')
)
<         


        
3条回答
  •  忘掉有多难
    2020-12-22 12:43

    pg_query returns a result resource.

    $result = pg_query('SELECT * FROM regexp_test');
    
    while ($row = pg_fetch_row($result)) {
      echo "$row";
    }
    

    pg_query returns false on error

    If an error occurs, and FALSE is returned, details of the error can be retrieved using the pg_last_error() function if the connection is valid.

提交回复
热议问题