Re: plpgsql variable assignment not supporting distinct anymore

2021-01-22 Thread Tom Lane
Pavel Stehule writes: > pá 22. 1. 2021 v 14:41 odesílatel napsal: >> ERROR: syntax error at or near "DISTINCT" >> LINE 8: _test := DISTINCT a FROM ( VALUES ( (true), ( true ) ) )... > Using DISTINCT is not a good solution. Yeah. It wouldn't be as painful to support this in the grammar as

Re: plpgsql variable assignment not supporting distinct anymore

2021-01-22 Thread easteregg
> Probably the fix is not hard, but it is almost the same situation as the > UNION case. The result of your code is not deterministic > > If there are more different ti_resource_id then some values can be randomly > ignored - when hash agg is used. > > The safe fix should be > > _resource_id :=

Re: plpgsql variable assignment not supporting distinct anymore

2021-01-22 Thread easteregg
the code provided is just a little poc to get the error ( which i have not included with my first mail sorry. ) ERROR: syntax error at or near "DISTINCT" LINE 8: _test := DISTINCT a FROM ( VALUES ( (true), ( true ) ) )... the code in production looked like this: _resource_id :=

Re: plpgsql variable assignment not supporting distinct anymore

2021-01-22 Thread Pavel Stehule
pá 22. 1. 2021 v 15:10 odesílatel napsal: > > Probably the fix is not hard, but it is almost the same situation as the > > UNION case. The result of your code is not deterministic > > > > If there are more different ti_resource_id then some values can be > randomly > > ignored - when hash agg is

Re: plpgsql variable assignment not supporting distinct anymore

2021-01-22 Thread Pavel Stehule
pá 22. 1. 2021 v 14:41 odesílatel napsal: > the code provided is just a little poc to get the error ( which i have not > included with my first mail sorry. ) > >ERROR: syntax error at or near "DISTINCT" >LINE 8: _test := DISTINCT a FROM ( VALUES ( (true), ( true ) ) )... > > > the co

plpgsql variable assignment not supporting distinct anymore

2021-01-22 Thread easteregg
hi, no noticed after the assignment with union ( https://www.postgresql.org/message-id/flat/20210105201257.f0d76aff%40mail.verfriemelt.org ), that the assignment with distinct is broken aswell. DO $$ DECLARE _test bool; BEGIN _test := DISTINCT a FROM ( VALUES ( (true), ( true

Re: plpgsql variable assignment not supporting distinct anymore

2021-01-22 Thread Pavel Stehule
pá 22. 1. 2021 v 9:21 odesílatel napsal: > hi, > > no noticed after the assignment with union ( > https://www.postgresql.org/message-id/flat/20210105201257.f0d76aff%40mail.verfriemelt.org > ), that the assignment with distinct is broken aswell. > > > > DO $$ > DECLARE > _test bool; > BE