Hello,

I could not execute sample code of plsql.sgml. PostgreSQL version is 7.1.3.
Then I made patches for reference. 

1) cs_refresh_one_mv function sample code bug.  *** 512,526 ****
2) Singule quotation missing.   *** 1152,1158 ****
3) cs_refresh_mviews function sample code bug.  *** 1305,1313 ****

Please review my patch.
Thank you.


Following plsqlORG.sgml file is a current CVS file.


*** plsqlORG.sgml	Fri Oct  5 17:19:53 2001
--- plsql.sgml	Fri Oct  5 17:32:16 2001
***************
*** 512,526 ****
                 WHERE sort_key=key;
  
          IF NOT FOUND THEN
!            RAISE EXCEPTION ''View '' || key || '' not found'';
             RETURN 0;
          END IF;
  
          -- The mv_name column of cs_materialized_views stores view
          -- names.
   
!         TRUNCATE TABLE table_data.mv_name;
!         INSERT INTO table_data.mv_name || '' '' || table_data.mv_query;
  
          return 1;
  end;
--- 512,526 ----
                 WHERE sort_key=key;
  
          IF NOT FOUND THEN
!            RAISE EXCEPTION ''View % not found'',key;
             RETURN 0;
          END IF;
  
          -- The mv_name column of cs_materialized_views stores view
          -- names.
   
!         EXECUTE ''TRUNCATE TABLE '' || quote_ident(table_data.mv_name);
!         EXECUTE ''INSERT INTO '' || quote_ident(table_data.mv_name) || '' '' || table_data.mv_query;
  
          return 1;
  end;
***************
*** 1152,1158 ****
  FOR i IN 1..10 LOOP
    -- some expressions here
  
!     RAISE NOTICE 'i is %',i;
  END LOOP;
  
  FOR i IN REVERSE 1..10 LOOP
--- 1152,1158 ----
  FOR i IN 1..10 LOOP
    -- some expressions here
  
!     RAISE NOTICE ''i is %'',i;
  END LOOP;
  
  FOR i IN REVERSE 1..10 LOOP
***************
*** 1305,1313 ****
  
           -- Now "mviews" has one record from cs_materialized_views
  
!          PERFORM cs_log(''Refreshing materialized view '' || mview.mv_name || ''...'');
!          TRUNCATE TABLE mview.mv_name;
!          INSERT INTO mview.mv_name || '' '' || mview.mv_query;
       END LOOP;
  
       PERFORM cs_log(''Done refreshing materialized views.'');
--- 1305,1313 ----
  
           -- Now "mviews" has one record from cs_materialized_views
  
!          PERFORM cs_log(''Refreshing materialized view '' || quote_ident(mviews.mv_name) || ''...'');
!          EXECUTE ''TRUNCATE TABLE  '' || quote_ident(mviews.mv_name);
!          EXECUTE ''INSERT INTO '' || quote_ident(mviews.mv_name) || '' '' || mviews.mv_query;
       END LOOP;
  
       PERFORM cs_log(''Done refreshing materialized views.'');

---
Junichi Kobayasi

Tue, 09 Oct 2001 10:26:08 +0900
KobayashiJunichi <junichi@sra.co.jp>
PL/pgSQL doc sample bug? (in 7.1.3)
KobayashiJunichi <junichi@sra.co.jp> writes:
> I could not execute sample code of plsql.sgml. PostgreSQL version is 7.1.3.
> Then I made patches for reference. 

Thanks for the corrections!

			regards, tom lane

Tue, 09 Oct 2001 00:56:16 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: PL/pgSQL doc sample bug? (in 7.1.3) 