From: | Lakradi Marwan <lakradimarwan(at)gmail(dot)com> |
---|---|
To: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
Cc: | PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
Subject: | Re: BUG #15904: ERROR: argument of LIMIT must not contain variables |
Date: | 2019-07-12 07:15:46 |
Message-ID: | CAF5OE-zgnmn++jAVX1WVxsL+yROjvJp-kQop8DT=2g8MZLhtvA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Thank you for the clarification and for the time you gave me.
I was convinced of that kind of answer, I still wanted to try, on a
misunderstanding you never know !
I will find a workaround, however the LIMIT_TILL clause would have been
welcomed in this particular case.
Wishing you an excellent weekend.
Marwan L.
Le jeu. 11 juil. 2019 à 18:45, David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
a écrit :
> On Thu, Jul 11, 2019 at 9:26 AM Lakradi Marwan <lakradimarwan(at)gmail(dot)com>
> wrote:
>
>> Thank you for your quick feedback,
>>
>> In my opinion, your query should return :
>> Id, Text
>> 1| 1, 'one'
>>
>> and be interpreted as due to variable type :
>> LIMIT CASE WHEN 1 = 1 THEN 1 ELSE 2 END;
>>
>> Am I wrong in the way I see the situation ?
>>
>> I think that in the case of a variable, the data should be retrieved
>> until the condition is reached. Like LIMIT_TILL {condition}
>>
>
> That's not an unreasonable expectation. But that isn't how LIMIT is
> defined. LIMIT provides a query result max record count to return to the
> client - mostly to facilitate pagination when used in concert with ORDER BY
> (for determinism) and OFFSET (to skip already seen records). That max is a
> constant determined at plan time which means it cannot rely upon any of the
> data the query itself may generate.
>
> SQL is set oriented and your expectation is incompatible with that
> fundamental property of the system. If you don't want records "after"
> something you need to apply a inequality filter in the WHERE clause to
> remove the undesired records.
>
> David J.
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2019-07-12 07:57:22 | Re: BUG #15905: FATAL: the database system is starting up |
Previous Message | David Rowley | 2019-07-12 07:14:37 | Re: PG11 - Multiple Key Range Partition |