Collected from the PG bugs email list.
|OS||Mac OS X - High Sierra|
|Reported by||Lakradi Marwan|
Body of first available message related to this bug follows.
The following bug has been logged on the website: Bug reference: 15904 Logged by: Lakradi Marwan Email address: (redacted) PostgreSQL version: 11.4 Operating system: Mac OS X - High Sierra Description: Good afternoon, I would like to be able to conditionally limit my query (without python script) based on a column value (for dynamic limit) See example below: SELECT summary.* FROM ( SELECT id, amount, date, SUM(amount) OVER (PARTITION BY customer ORDER BY date, id) as amount_summed FROM customer ORDER BY date DESC, id DESC ) AS summary LIMIT CASE WHEN summary.amount_summed >= 0 THEN summary.id ELSE NULL END; The limit doesn't work, whereas : - LIMIT CASE WHEN 100.0 >= 0 THEN 10 ELSE NULL END; works well ! I don't see the point, what is the main difference between summary.amount_summed which is a float, and directly pass 100.0 ?
|2019-07-11 15:05:29+00||PG Bug reporting form||BUG #15904: ERROR: argument of LIMIT must not contain variables|
|2019-07-11 15:27:44+00||"David G(dot) Johnston"||Re: BUG #15904: ERROR: argument of LIMIT must not contain variables|
|2019-07-11 16:26:41+00||Lakradi Marwan||Re: BUG #15904: ERROR: argument of LIMIT must not contain variables|
|2019-07-11 16:45:42+00||"David G(dot) Johnston"||Re: BUG #15904: ERROR: argument of LIMIT must not contain variables|
|2019-07-12 07:15:46+00||Lakradi Marwan||Re: BUG #15904: ERROR: argument of LIMIT must not contain variables|