"writable CTEs"
As a side note, I think the term "writable CTE" is a misnomer. The CTE
is not writable. The CTE is the result of a write operation.
A writable CTE would look like this:
WITH foo AS (SELECT ...) UPDATE foo SET ...
a bit like an updatable view.
AFAICT, the current patch doesn't use the term, so there is no problem,
but just for those who are preparing propaganda and such.
On 2010-12-22 8:28 PM, Peter Eisentraut wrote:
As a side note, I think the term "writable CTE" is a misnomer. The CTE
is not writable. The CTE is the result of a write operation.A writable CTE would look like this:
WITH foo AS (SELECT ...) UPDATE foo SET ...
a bit like an updatable view.
AFAICT, the current patch doesn't use the term, so there is no problem,
but just for those who are preparing propaganda and such.
I think I've used "DML WITH" in the patch, but I don't like that either.
Naming this feature seems to be quite a challenge.
I'd prefer something short but easily understandable, but those two
might be mutually exclusive.
Regards,
Marko Tiikkaja
On Wed, Dec 22, 2010 at 10:44 AM, Marko Tiikkaja
<marko.tiikkaja@cs.helsinki.fi> wrote:
I'd prefer something short but easily understandable, but those two might be
mutually exclusive.
Volatile CTE's doesn't add any more clarity either. Maybe "Round Trip
Reduction" CTE's. :)
--
Regards,
Richard Broersma Jr.
Marko Tiikkaja <marko.tiikkaja@cs.helsinki.fi> wrote:
I think I've used "DML WITH" in the patch, but I don't like that
either. Naming this feature seems to be quite a challenge.I'd prefer something short but easily understandable, but those
two might be mutually exclusive.
How about?:
DML CTEs
DML-based CTEs
RETURNING-based CTEs
-Kevin
On Wed, Dec 22, 2010 at 12:54:39PM -0600, Kevin Grittner wrote:
Marko Tiikkaja <marko.tiikkaja@cs.helsinki.fi> wrote:
I think I've used "DML WITH" in the patch, but I don't like that
either. Naming this feature seems to be quite a challenge.I'd prefer something short but easily understandable, but those
two might be mutually exclusive.How about?:
DML CTEs
DML-based CTEs
RETURNING-based CTEs
When I designed the feature, I'd planned to be able to put most kinds
of statement inside or outside the CTE, not just DML writes. You can
imagine cases for DCL (GRANT/REVOKE based on a catalog query) or DDL
(partition management), and I did.
We could call them, "Expanded CTEs," but that only freezes the prior
norm making them read-only, so I think "Writeable CTEs" captures it
pretty well.
Cheers,
David.
--
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david.fetter@gmail.com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics
Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate
On ons, 2010-12-22 at 20:44 +0200, Marko Tiikkaja wrote:
On 2010-12-22 8:28 PM, Peter Eisentraut wrote:
As a side note, I think the term "writable CTE" is a misnomer. The CTE
is not writable. The CTE is the result of a write operation.A writable CTE would look like this:
WITH foo AS (SELECT ...) UPDATE foo SET ...
a bit like an updatable view.
AFAICT, the current patch doesn't use the term, so there is no problem,
but just for those who are preparing propaganda and such.I think I've used "DML WITH" in the patch, but I don't like that either.
Naming this feature seems to be quite a challenge.
*Writing* CTEs is more accurate.
On Mon, Dec 27, 2010 at 11:47:14PM +0200, Peter Eisentraut wrote:
On ons, 2010-12-22 at 20:44 +0200, Marko Tiikkaja wrote:
On 2010-12-22 8:28 PM, Peter Eisentraut wrote:
As a side note, I think the term "writable CTE" is a misnomer. The CTE
is not writable. The CTE is the result of a write operation.A writable CTE would look like this:
WITH foo AS (SELECT ...) UPDATE foo SET ...
a bit like an updatable view.
AFAICT, the current patch doesn't use the term, so there is no problem,
but just for those who are preparing propaganda and such.I think I've used "DML WITH" in the patch, but I don't like that either.
Naming this feature seems to be quite a challenge.*Writing* CTEs is more accurate.
OK :)
On the bright side, we have a decades-long tradition of horrible names
on this project, one early example of which is a name that abbreviates
the phrase, 'POST-"interactive GRaphics REtrieval System."' ;)
Cheers,
David.
--
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david.fetter@gmail.com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics
Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate
It's worth noting that officially (i.e. in the docs), we don't even
call CTEs CTEs at any point. We call them WITH queries. I think that
that's a mistake because we call them CTEs everywhere else.
Is there interest in correcting this, by putting "CTEs" or "Common
table expressions" in parenthesis after "WITH queries" in the docs at
certain select places? I could write a documentation patch.
--
Regards,
Peter Geoghegan
Peter Geoghegan wrote:
It's worth noting that officially (i.e. in the docs), we don't even
call CTEs CTEs at any point. We call them WITH queries. I think
that that's a mistake because we call them CTEs everywhere else.Is there interest in correcting this, by putting "CTEs" or "Common
table expressions" in parenthesis after "WITH queries" in the docs
at certain select places? I could write a documentation patch.
Personally, I think it's worth fixing. This sort of disjunction
between code and documentation can cause confusing for someone
trying to get started on hacking. It is an exception to the
otherwise excellent documentation of both the product and the code.
-Kevin
Import Notes
Resolved by subject fallback
On Tue, Dec 28, 2010 at 12:19:47AM +0000, Peter Geoghegan wrote:
It's worth noting that officially (i.e. in the docs), we don't even
call CTEs CTEs at any point. We call them WITH queries. I think that
that's a mistake because we call them CTEs everywhere else.
Agreed.
Is there interest in correcting this, by putting "CTEs" or "Common
table expressions" in parenthesis after "WITH queries" in the docs
at certain select places? I could write a documentation patch.
+1 :)
Cheers,
David.
--
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david.fetter@gmail.com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics
Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate
On Mon, Dec 27, 2010 at 9:28 PM, David Fetter <david@fetter.org> wrote:
On Tue, Dec 28, 2010 at 12:19:47AM +0000, Peter Geoghegan wrote:
It's worth noting that officially (i.e. in the docs), we don't even
call CTEs CTEs at any point. We call them WITH queries. I think that
that's a mistake because we call them CTEs everywhere else.Agreed.
Is there interest in correcting this, by putting "CTEs" or "Common
table expressions" in parenthesis after "WITH queries" in the docs
at certain select places? I could write a documentation patch.+1 :)
Would it make sense to work a section into the documentation
explaining the semantics of CTEs? e.g., evaluate-once.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
On Mon, Dec 27, 2010 at 09:51:01PM -0500, Robert Haas wrote:
On Mon, Dec 27, 2010 at 9:28 PM, David Fetter <david@fetter.org> wrote:
On Tue, Dec 28, 2010 at 12:19:47AM +0000, Peter Geoghegan wrote:
It's worth noting that officially (i.e. in the docs), we don't even
call CTEs CTEs at any point. We call them WITH queries. I think that
that's a mistake because we call them CTEs everywhere else.Agreed.
Is there interest in correcting this, by putting "CTEs" or "Common
table expressions" in parenthesis after "WITH queries" in the docs
at certain select places? I could write a documentation patch.+1 :)
Would it make sense to work a section into the documentation
explaining the semantics of CTEs? e.g., evaluate-once.
Yep. It should probably go where "WITH Queries" is now, i.e.
http://www.postgresql.org/docs/current/static/queries-with.html
would become (doesn't exist yet):
http://www.postgresql.org/docs/current/static/queries-common-table-expression.html
Cheers,
David.
--
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david.fetter@gmail.com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics
Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate
On 28 December 2010 01:09, Kevin Grittner <Kevin.Grittner@wicourts.gov> wrote:
Personally, I think it's worth fixing. This sort of disjunction
between code and documentation can cause confusing for someone
trying to get started on hacking. It is an exception to the
otherwise excellent documentation of both the product and the code.
Hmm. Having looked at the relevant sgml file, queries.sgml, common
table expressions appear at one point:
<indexterm>
<primary>common table expression</primary>
<see>WITH</see>
</indexterm>
This indicates that the term common table expression should be indexed
(the dead tree way), which isn't much use for the majority of users
that access the docs on the web. This term doesn't appear in the html
source. Perhaps whatever infrastructure we use to render the sgml
files as html for dot org should produce keyword meta tags for indexed
terms, in case anyone searches the docs using Altavista. More
seriously, if we did this I imagine we'd see WITH Queries (for
example) in the first page of results if we search for "common table
expression" from dot org directly. The fact that whatever docbook tool
we use doesn't already do this does suggests that it might not be such
a good idea. It may not be worth the effort. I've cc'd Thom Brown to
see what he thinks.
Attached documentation patch should make things clearer. I haven't
changed the "queries-with" section to
"queries-common-table-expression" per David's suggestion for the sake
of stability. I hesitate to change it without reaching a consensus -
will this break a lot of links?
The main change I've made is: "WITH queries, also referred to as
Common table expressions or CTEs, provide a way to write subqueries
for use as part of a larger query". I'm concerned that this might not
be strictly correct, because the term "WITH query" may not be exactly
equivalent to the term "CTE" - WITH queries are comprised of one or
more CTEs, plus a main query. Or are they?
Comments?
--
Regards,
Peter Geoghegan
Attachments:
cte_doc.patchtext/x-patch; charset=US-ASCII; name=cte_doc.patchDownload+5-5
On Tue, Dec 28, 2010 at 03:49:16AM +0000, Peter Geoghegan wrote:
On 28 December 2010 01:09, Kevin Grittner <Kevin.Grittner@wicourts.gov> wrote:
Personally, I think it's worth fixing. �This sort of disjunction
between code and documentation can cause confusing for someone
trying to get started on hacking. �It is an exception to the
otherwise excellent documentation of both the product and the code.Hmm. Having looked at the relevant sgml file, queries.sgml, common
table expressions appear at one point:<indexterm>
<primary>common table expression</primary>
<see>WITH</see>
</indexterm>This indicates that the term common table expression should be
indexed (the dead tree way), which isn't much use for the majority
of users that access the docs on the web. This term doesn't appear
in the html source. Perhaps whatever infrastructure we use to render
the sgml files as html for dot org should produce keyword meta tags
for indexed terms, in case anyone searches the docs using Altavista.
More seriously, if we did this I imagine we'd see WITH Queries (for
example) in the first page of results if we search for "common table
expression" from dot org directly. The fact that whatever docbook
tool we use doesn't already do this does suggests that it might not
be such a good idea. It may not be worth the effort. I've cc'd Thom
Brown to see what he thinks.Attached documentation patch should make things clearer. I haven't
changed the "queries-with" section to
"queries-common-table-expression" per David's suggestion for the
sake of stability. I hesitate to change it without reaching a
consensus - will this break a lot of links?
I don't see how people can be relying on links to 9.1-to-be's
documentation.
The main change I've made is: "WITH queries, also referred to as
Common table expressions or CTEs, provide a way to write subqueries
for use as part of a larger query". I'm concerned that this might
not be strictly correct, because the term "WITH query" may not be
exactly equivalent to the term "CTE" - WITH queries are comprised of
one or more CTEs, plus a main query. Or are they?
They are. :)
Cheers,
David.
--
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david.fetter@gmail.com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics
Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate
On Tue, Dec 28, 2010 at 12:45 AM, David Fetter <david@fetter.org> wrote:
I don't see how people can be relying on links to 9.1-to-be's
documentation.
Well, it's always handy when the filenames are the same across
versions. Ever looked at the 9.0 documentation for something and then
modified the URL to see what it looked like in 8.1 or something?
The main change I've made is: "WITH queries, also referred to as
Common table expressions or CTEs, provide a way to write subqueries
for use as part of a larger query". I'm concerned that this might
not be strictly correct, because the term "WITH query" may not be
exactly equivalent to the term "CTE" - WITH queries are comprised of
one or more CTEs, plus a main query. Or are they?They are. :)
No, actually I think Peter has it right. A query with one or more
common table expressions is a WITH-query. This is a subtle difference
but could affect the way that things are phrased in the documentation.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Excerpts from David Fetter's message of mar dic 28 02:45:11 -0300 2010:
On Tue, Dec 28, 2010 at 03:49:16AM +0000, Peter Geoghegan wrote:
Attached documentation patch should make things clearer. I haven't
changed the "queries-with" section to
"queries-common-table-expression" per David's suggestion for the
sake of stability. I hesitate to change it without reaching a
consensus - will this break a lot of links?I don't see how people can be relying on links to 9.1-to-be's
documentation.
If you change it to give it a new name, the old name disappears.
It's a little thing but we've gotten complaints about links disappearing
from one version to another. (Personally this has given me reason to
think that the "/current" link to docs are a bad idea).
--
Álvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
On 28 December 2010 12:09, Robert Haas <robertmhaas@gmail.com> wrote:
On Tue, Dec 28, 2010 at 12:45 AM, David Fetter <david@fetter.org> wrote:
I don't see how people can be relying on links to 9.1-to-be's
documentation.Well, it's always handy when the filenames are the same across
versions. Ever looked at the 9.0 documentation for something and then
modified the URL to see what it looked like in 8.1 or something?
I do this all the time. Anyway, I intend for this doc patch to be
backported to 8.4 as a bugfix, which is part of the reason why it
isn't invasive - it's just a clarification. Clearly if it makes sense
for 9.1, it makes just as much sense for 9.0 and 8.4.
No, actually I think Peter has it right. A query with one or more
common table expressions is a WITH-query. This is a subtle difference
but could affect the way that things are phrased in the documentation.
Attached is a new patch written with this consideration in mind. It
also has an acronym.sgml entry for CTE, which was absent from my
earlier patch. I think David actually agreed that I was right to have
doubts.
--
Regards,
Peter Geoghegan
Attachments:
cte_doc.patchtext/x-patch; charset=US-ASCII; name=cte_doc.patchDownload+12-2
On tis, 2010-12-28 at 00:19 +0000, Peter Geoghegan wrote:
It's worth noting that officially (i.e. in the docs), we don't even
call CTEs CTEs at any point. We call them WITH queries. I think that
that's a mistake because we call them CTEs everywhere else.
I think "WITH query" or "WITH clause" is more understandable than CTE,
which to me is a term that has no relationship with anything else.
Peter Eisentraut <peter_e@gmx.net> writes:
On tis, 2010-12-28 at 00:19 +0000, Peter Geoghegan wrote:
It's worth noting that officially (i.e. in the docs), we don't even
call CTEs CTEs at any point. We call them WITH queries. I think that
that's a mistake because we call them CTEs everywhere else.
I think "WITH query" or "WITH clause" is more understandable than CTE,
which to me is a term that has no relationship with anything else.
I'm with Peter on that. CTE is a completely meaningless term to most
users.
As for the problem at hand, couldn't we use "WITH ... RETURNING", or
some other phrase based on what users actually see/write? DML has
the same problem as CTE, namely it's just another damn TLA. It may
be one that more people have heard of, but that doesn't make it
particularly attractive.
regards, tom lane
On 28 December 2010 14:53, Tom Lane <tgl@sss.pgh.pa.us> wrote:
I'm with Peter on that. CTE is a completely meaningless term to most
users.
I don't believe that that's the case. If CTE is a completely
meaningless term to most users, WITH query is even more meaningless. I
never refer to WITH queries in conversation, and I have never heard
someone else do so. I have often talked about CTEs though. Besides,
I'm not suggesting that we should completely change the title, or
change the section name at all, or change any existing text from the
docs. The doc patch is just a clarification that I believe will be
useful.
If I search for "common table expressions" on Wikipedia, I am sent to
the common table expressions article, without any re-direction. The
article doesn't mention "with query" as a synonym of CTE at any point.
If I search for "With query", the first page of results (20 articles)
doesn't have anything about CTEs at all. The situation with Google is
similar. The situation with postgresql.org is similar, except that
searching for CTE there is fairly useless too. Granted, all of this
may have something to do with the ambiguity of the term "with query"
in a more general context, but the fact that I never hear the term in
conversation probably has something to do with that too.
--
Regards,
Peter Geoghegan