On 04/30/2017 09:46 AM, Andres Freund wrote:
> Hi,
>
> On 2017-04-30 13:58:14 +0800, Craig Ringer wrote:
>> We have OFFSET 0 for anyone really depending on it, and at least when you
>> read that you know to go "wtf" and look at the manual, wheras the CTE fence
>> behaviour is invisible and silent.
>
> I don't think that's a good idea. What if you need to prevent inlining
> of something that actually needs an offset? What if the behaviour of
> offset is ever supposed to change? Relying more on that seems to just
> be repeating the mistake around CTEs.
>
I agree with this. But OFFSET 0 would force people to modify the queries
anyway, so why not just introduce a new keyword instead? Something like:
WITH FENCED a (SELECT ...)
But I think something like that was proposed not too long ago, and did
not make it for some reason.
There's a lot of other CTE improvements that would be great. Say, being
able to define indexes on them, but that's really a separate topic.
regards
--
Tomas Vondra http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services