Thread: Non-existent cs_log function

Non-existent cs_log function

From
Thom Brown
Date:
It's been pointed out that on the pl/pgsql control structures page
(http://www.postgresql.org/docs/9.0/interactive/plpgsql-control-structures.html)
there's an example using a cs_log function, which doesn't exist.  I'm
assuming this is supposed to be an example of a custom logging
function someone might have, but it might cause less confusion if
these were changed to RAISE calls, or something else that exists.

What do you think?

--
Thom Brown
Twitter: @darkixion
IRC (freenode): dark_ixion
Registered Linux user: #516935

Re: Non-existent cs_log function

From
Robert Haas
Date:
On Fri, Feb 11, 2011 at 8:46 PM, Thom Brown <thom@linux.com> wrote:
> It's been pointed out that on the pl/pgsql control structures page
> (http://www.postgresql.org/docs/9.0/interactive/plpgsql-control-structures.html)
> there's an example using a cs_log function, which doesn't exist.  I'm
> assuming this is supposed to be an example of a custom logging
> function someone might have, but it might cause less confusion if
> these were changed to RAISE calls, or something else that exists.
>
> What do you think?

I agree.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Re: Non-existent cs_log function

From
Bruce Momjian
Date:
Thom Brown wrote:
> It's been pointed out that on the pl/pgsql control structures page
> (http://www.postgresql.org/docs/9.0/interactive/plpgsql-control-structures.html)
> there's an example using a cs_log function, which doesn't exist.  I'm
> assuming this is supposed to be an example of a custom logging
> function someone might have, but it might cause less confusion if
> these were changed to RAISE calls, or something else that exists.
>
> What do you think?

Done, in the attached applied patch.

--
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + It's impossible for everything to be true. +
diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml
index d0672bb..8da093b 100644
--- a/doc/src/sgml/plpgsql.sgml
+++ b/doc/src/sgml/plpgsql.sgml
@@ -2169,21 +2169,20 @@ CREATE FUNCTION cs_refresh_mviews() RETURNS integer AS $$
 DECLARE
     mviews RECORD;
 BEGIN
-    PERFORM cs_log('Refreshing materialized views...');
+    RAISE NOTICE 'Refreshing materialized views...';

     FOR mviews IN SELECT * FROM cs_materialized_views ORDER BY sort_key LOOP

         -- Now "mviews" has one record from cs_materialized_views

-        PERFORM cs_log('Refreshing materialized view '
-                   || quote_ident(mviews.mv_name) || ' ...');
+        RAISE NOTICE 'Refreshing materialized view %s ...', 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.');
+    RAISE NOTICE 'Done refreshing materialized views.';
     RETURN 1;
 END;
 $$ LANGUAGE plpgsql;

Re: Non-existent cs_log function

From
Thom Brown
Date:
On 11 March 2011 13:48, Bruce Momjian <bruce@momjian.us> wrote:
> Thom Brown wrote:
>> It's been pointed out that on the pl/pgsql control structures page
>> (http://www.postgresql.org/docs/9.0/interactive/plpgsql-control-structures.html)
>> there's an example using a cs_log function, which doesn't exist.  I'm
>> assuming this is supposed to be an example of a custom logging
>> function someone might have, but it might cause less confusion if
>> these were changed to RAISE calls, or something else that exists.
>>
>> What do you think?
>
> Done, in the attached applied patch.

That's great.  Thanks Bruce.

--
Thom Brown
Twitter: @darkixion
IRC (freenode): dark_ixion
Registered Linux user: #516935

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company