CREATE FUNCTION cs_refresh_mviews() RETURNS integer AS $$
DECLARE
mviews RECORD;
BEGIN
PERFORM cs_log('Refreshing materialized views...');
FOR mviews IN SELECT * FROM cs_materialized_views ORDER BY sort_key LOOP
-- How For columns of mviews?
END LOOP;
PERFORM cs_log('Done refreshing materialized views.');
RETURN 1;
END;
$$ LANGUAGE plpgsql;
我想获取 mviews 中列的值。mviews 的浏览器列如何用于 For 或 While?与以下相同:
For i=0 to mviews.columns.count step i++
raise mviews[i]