public inbox for [email protected]
help / color / mirror / Atom feedFrom: Erik Rijkers <[email protected]>
To: Peter Eisentraut <[email protected]>
Cc: Tom Lane <[email protected]>
Cc: [email protected]
Subject: Re: code example wrapping
Date: Tue, 6 Apr 2010 02:43:32 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
On Mon, April 5, 2010 19:29, Peter Eisentraut wrote:
> On mån, 2010-04-05 at 18:30 +0200, Erik Rijkers wrote:
>> On Mon, April 5, 2010 18:18, Tom Lane wrote:
>> > "Erik Rijkers" <[email protected]> writes:
>> >
>> >> I would like to reformat (only) those cases so that the text is completely readable on the
Here is plpgsql.sgml with reformatted code-examples for pdf readability
(mainly split long lines; also fixed an concat error in one example).
I've checked A4+US pdf's and html with these changes - they look OK, I think.
Thanks,
Erik Rijkers
Attachments:
[application/octet-stream] plpgsql.sgml.diff (4.7K, 2-plpgsql.sgml.diff)
download | inline diff:
--- doc/src/sgml/plpgsql.sgml.orig 2010-04-06 00:29:32.000000000 +0200
+++ doc/src/sgml/plpgsql.sgml 2010-04-06 02:06:51.000000000 +0200
@@ -481,9 +481,11 @@
is with <literal>RETURNS TABLE</>, for example:
<programlisting>
-CREATE FUNCTION extended_sales(p_itemno int) RETURNS TABLE(quantity int, total numeric) AS $$
+CREATE FUNCTION extended_sales(p_itemno int)
+RETURNS TABLE(quantity int, total numeric) AS $$
BEGIN
- RETURN QUERY SELECT quantity, quantity * price FROM sales WHERE itemno = p_itemno;
+ RETURN QUERY SELECT quantity, quantity * price FROM sales
+ WHERE itemno = p_itemno;
END;
$$ LANGUAGE plpgsql;
</programlisting>
@@ -2154,9 +2156,12 @@
-- Now "mviews" has one record from cs_materialized_views
- PERFORM cs_log('Refreshing materialized view ' || quote_ident(mviews.mv_name) || ' ...');
+ 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;
+ EXECUTE 'INSERT INTO '
+ || quote_ident(mviews.mv_name) || ' '
+ || mviews.mv_query;
END LOOP;
PERFORM cs_log('Done refreshing materialized views.');
@@ -2495,7 +2500,8 @@
<title><command>OPEN FOR EXECUTE</command></title>
<synopsis>
-OPEN <replaceable>unbound_cursorvar</replaceable> <optional> <optional> NO </optional> SCROLL </optional> FOR EXECUTE <replaceable class="command">query_string</replaceable> <optional> USING <replaceable>expression</replaceable> <optional>, ... </optional> </optional>;
+OPEN <replaceable>unbound_cursorvar</replaceable> <optional> <optional> NO </optional> SCROLL </optional> FOR EXECUTE <replaceable class="command">query_string</replaceable>
+ <optional> USING <replaceable>expression</replaceable> <optional>, ... </optional> </optional>;
</synopsis>
<para>
@@ -2517,7 +2523,8 @@
<para>
An example:
<programlisting>
-OPEN curs1 FOR EXECUTE 'SELECT * FROM ' || quote_ident(tabname) ' WHERE col1 = $1' USING keyvalue;
+OPEN curs1 FOR EXECUTE 'SELECT * FROM ' || quote_ident(tabname)
+ || ' WHERE col1 = $1' USING keyvalue;
</programlisting>
In this example, the table name is inserted into the query textually,
so use of <function>quote_ident()</> is recommended to guard against
@@ -2810,6 +2817,7 @@
END;
' LANGUAGE plpgsql;
+-- need to be in a transaction to use cursors.
BEGIN;
SELECT reffunc2();
@@ -2966,7 +2974,8 @@
This example will abort the transaction with the given error message
and hint:
<programlisting>
-RAISE EXCEPTION 'Nonexistent ID --> %', user_id USING HINT = 'Please check your user id';
+RAISE EXCEPTION 'Nonexistent ID --> %', user_id
+ USING HINT = 'Please check your user id';
</programlisting>
</para>
@@ -3394,7 +3403,8 @@
--
-- Function and trigger to amend summarized column(s) on UPDATE, INSERT, DELETE.
--
-CREATE OR REPLACE FUNCTION maint_sales_summary_bytime() RETURNS TRIGGER AS $maint_sales_summary_bytime$
+CREATE OR REPLACE FUNCTION maint_sales_summary_bytime() RETURNS TRIGGER
+AS $maint_sales_summary_bytime$
DECLARE
delta_time_key integer;
delta_amount_sold numeric(15,2);
@@ -3416,7 +3426,8 @@
-- (probably not too onerous, as DELETE + INSERT is how most
-- changes will be made).
IF ( OLD.time_key != NEW.time_key) THEN
- RAISE EXCEPTION 'Update of time_key : % -> % not allowed', OLD.time_key, NEW.time_key;
+ RAISE EXCEPTION 'Update of time_key : % -> % not allowed',
+ OLD.time_key, NEW.time_key;
END IF;
delta_time_key = OLD.time_key;
@@ -3867,7 +3878,7 @@
<para>
Another good way to develop in <application>PL/pgSQL</> is with a
GUI database access tool that facilitates development in a
- procedural language. One example of such as a tool is
+ procedural language. One example of such a tool is
<application>pgAdmin</>, although others exist. These tools often
provide convenient features such as escaping single quotes and
making it easier to recreate and debug functions.
@@ -4450,7 +4461,8 @@
IF a_running_job_count > 0 THEN
COMMIT; -- free lock<co id="co.plpgsql-porting-commit">
- raise_application_error(-20000, 'Unable to create a new job: a job is currently running.');
+ raise_application_error(-20000,
+ 'Unable to create a new job: a job is currently running.');
END IF;
DELETE FROM cs_active_job;
view thread (13+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: code example wrapping
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox