Doc Patch: Subquery section to say that subqueries can't modify data

From: "Karl O(dot) Pinc" <kop(at)meme(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Doc Patch: Subquery section to say that subqueries can't modify data
Date: 2013-08-06 21:03:13
Message-ID: 1375822993.31841.1@slate
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

The attached documentation patch, doc-subqueries-v1.patch,
applies against head.

I wanted to document that subqueries can't modify data.
This is mentioned in the documentation for SELECT and
implied elsewhere but I was looking for something more
than an 'in-passing' mention.

(I wrote a bad query,
modifying data in a subquery, couldn't recall where
it was documented that you can't do this, and couldn't
find the answer from the TOC or the index. Now that
there's lots of statements with RETURNING clauses
it's natural to want to use them in subqueries.)

There seemed to be no good place to put this in the
tutorial section of the documentation. I wound
up adding a small, 2 paragraph, section describing subqueries to
the chapter on queries. Although the first paragraph
echos what's already documented the utility of
subqueries is such that it's nice to have a
place in the tutorial that serves as a single point of
reference.

The alternative seemed to be to put the 2nd paragraph
in "9.22. Subquery Expressions", and this didn't seem
to fit well.

The last 2 sentences of the first paragraph are
something in the way of helpful hints and may not
be appropriate, or even accurate. I've left them in
for review.

Regards,

Karl <kop(at)meme(dot)com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

Attachment Content-Type Size
doc-subqueries-v1.patch text/x-patch 2.7 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Stark 2013-08-06 22:10:11 Re: Review: UNNEST (and other functions) WITH ORDINALITY
Previous Message Bruce Momjian 2013-08-06 20:42:12 Re: DATE type output does not follow datestyle parameter