Re: WIP Patch for GROUPING SETS phase 1 - Mailing list pgsql-hackers
From | Robert Haas |
---|---|
Subject | Re: WIP Patch for GROUPING SETS phase 1 |
Date | |
Msg-id | CA+TgmoZ-+yZCKaHo3ejj2VqTwJicBb_TcTZCOpehyJPW_W=W-Q@mail.gmail.com Whole thread Raw |
In response to | Re: WIP Patch for GROUPING SETS phase 1 (Tom Lane <tgl@sss.pgh.pa.us>) |
Responses |
Re: WIP Patch for GROUPING SETS phase 1
|
List | pgsql-hackers |
On Thu, Aug 21, 2014 at 2:13 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote: > Andrew Gierth <andrew@tao11.riddles.org.uk> writes: >> "Tom" == Tom Lane <tgl@sss.pgh.pa.us> writes: >> Tom> I wonder if you've tried hard enough to avoid reserving the keyword. > >> GROUP BY cube(a,b) is currently legal syntax and means something completely >> incompatible to what the spec requires. > > Well, if there are any extant applications that use that exact phrasing, > they're going to be broken in any case. That does not mean that we have > to break every other appearance of "cube". I think that special-casing > appearances of cube(...) in GROUP BY lists might be a feasible approach. Not really. As pointed out downthread, you can't distinguish "cube" from CUBE. We could fix that with a big enough hammer, of course, but it would be a mighty big hammer. More generally, I think it makes a lot of sense to "work harder" to reserve keywords less when there's no fundamental semantic conflict, but when there is, trying to do things like special case stuff depending on context results in a situation where some keywords are a little more reserved than others. As you pointed out in discussions of CREATE INDEX CONCURRENTLY, that's confusing: http://www.postgresql.org/message-id/10769.1261775601@sss.pgh.pa.us (refer second paragraph) I think we should: (1) Rename the cube extension. With a bat. I have yet to encounter a single user who is using it, but there probably are some. They'll have to get over it; GROUPING SETS is roughly a hundred times more important than the cube extension. The most I'd do to cater to existing users of the extension is provide an SQL script someplace that renames the extension and all of its containing objects so that you can do that before running pg_dump/pg_upgrade. (2) Reserve CUBE to the extent necessary to implement this feature. Some people won't like this, but that's always true when we reserve a keyword, and I don't think refusing to implement an SQL-standard feature for which there is considerable demand is the right way to fix that. Here are the last five keywords we partially or fully reserved: LATERAL (fully reserved), COLLATION (type_func_name), XMLEXISTS (col_name), BETWEEN (was type_func_name, became col_name), CONCURRENTLY (type_func_name). That takes us back to December 2009, so the rate at which we do this is just under one a year, and there haven't been many screams about it. I grant you that "cube" is a slightly more plausible identifier than any of those, but I don't think we should let the fact that we happen to have an extension with that name prejudice us too much about how common it really is. Mind you, I'm not trying to say that we don't need to be judicious in reserving keywords, or even adding them at all: I've argued against those things on numerous occasions, and have done work to let us get rid of keywords we've previously had. I just think that this is a big enough, important enough feature that we'll please more people than we disappoint. And I think trying to walk some middle way where we distinguish on context is going to be a mess. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
pgsql-hackers by date: