pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <bruce@momjian.us>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Jonathan Pool <pool@utilika.org>
Cc: pgsql-bugs@postgresql.org, Susan Colowick <smc@utilika.org>
Subject: Re: Documentation bug: Chapter 35.4, paragraph 4
Date: Thu, 10 Mar 2011 18:50:56 -0500 (EST)
Message-ID: <201103102350.p2ANouw26781@momjian.us> (raw)
In-Reply-To: <AANLkTi=ieF0EjDD4E2X=_8DZcc82kwyobduC19u8f3pf@mail.gmail.com>

Robert Haas wrote:
> On Tue, Nov 23, 2010 at 1:08 PM, Jonathan Pool <pool@utilika.org> wrote:
> > Chapter 35.4, paragraph 4, of the PostgreSQL 9.0.1 Documentation says:
> >
> > Any collection of commands in the SQL language can be packaged together and defined as a function. Besides SELECT queries, the commands can include data modification queries (INSERT, UPDATE, and DELETE), as well as other SQL commands. (The only exception is that you cannot put BEGIN, COMMIT, ROLLBACK, or SAVEPOINT commands into a SQL function.)
> >
> > This appears to be incorrect, in that attempting to include a VACUUM command in a query-language function elicits the following error message:
> >
> > ERROR: ?VACUUM cannot be executed from a function or multi-command string
> >
> > Thus, presumably "VACUUM" should be added to the list of exceptions.
> 
> I fear it's worse than that.  Taking a look at the places where we
> call PreventTransactionChain(), they appear to include database-wide
> CLUSTER, DISCARD ALL, VACUUM (as you noted), COMMIT PREPARED, ROLLBACK
> PREPARED, CREATE TABLESPACE, DROP TABLESPACE, ALTER TYPE <enum> ADD
> VALUE <label> (but the PreventTransactionChain call says ADD rather
> than ADD VALUE), CREATE INDEX CONCURRENTLY, CREATE DATABASE, DROP
> DATABASE, and REINDEX DATABASE.
> 
> I'm not sure if there's some generic way we could refer to all that
> rather than listing them all individually.

I just made the wording more generic;  we rarely are asked about this,
so generic seemed appropriate.  Applied doc patch attached.

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

  + It's impossible for everything to be true. +

Attachments:

/rtmp/doc.diff (text/x-diff, 1.4K) download diff --git a/doc/src/sgml/xfunc.sgml b/doc/src/sgml/xfunc.sgml new file mode 100644 index c65f852..1a35014 *** a/doc/src/sgml/xfunc.sgml --- b/doc/src/sgml/xfunc.sgml *************** *** 116,124 **** Besides <command>SELECT</command> queries, the commands can include data modification queries (<command>INSERT</command>, <command>UPDATE</command>, and <command>DELETE</command>), as well as ! other SQL commands. (The only exception is that you cannot put ! <command>BEGIN</>, <command>COMMIT</>, <command>ROLLBACK</>, or ! <command>SAVEPOINT</> commands into a <acronym>SQL</acronym> function.) However, the final command must be a <command>SELECT</command> or have a <literal>RETURNING</> clause that returns whatever is --- 116,124 ---- Besides <command>SELECT</command> queries, the commands can include data modification queries (<command>INSERT</command>, <command>UPDATE</command>, and <command>DELETE</command>), as well as ! other SQL commands. (You cannot use transaction control commands, e.g. ! <command>COMMIT</>, <command>SAVEPOINT</>, and some utility ! commands, e.g. <literal>VACUUM</>, in <acronym>SQL</acronym> functions.) However, the final command must be a <command>SELECT</command> or have a <literal>RETURNING</> clause that returns whatever is

view thread (5+ messages)  latest in thread

Message-ID: <201103102350.p2ANouw26781@momjian.us>
Permalink:  ../201103102350.p2ANouw26781@momjian.us/
Also on:    postgresql.org/message-id/201103102350.p2ANouw26781@momjian.us

 ·  · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-docs@postgresql.org
  Cc: bruce@momjian.us, robertmhaas@gmail.com, pool@utilika.org, smc@utilika.org
  Subject: Re: Documentation bug: Chapter 35.4, paragraph 4
  In-Reply-To: <201103102350.p2ANouw26781@momjian.us>
  References: <AANLkTi=ieF0EjDD4E2X=_8DZcc82kwyobduC19u8f3pf@mail.gmail.com> <201103102350.p2ANouw26781@momjian.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox