From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | easteregg(at)verfriemelt(dot)org |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Subject: | Re: plpgsql variable assignment not supporting distinct anymore |
Date: | 2021-01-22 08:43:19 |
Message-ID: | CAFj8pRCicOt5+2A+qnYiZR+ryPDUV3Rof9nBZhy=K1jPkXNyYQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
pá 22. 1. 2021 v 9:21 odesílatel <easteregg(at)verfriemelt(dot)org> 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;
> BEGIN
>
> _test := DISTINCT a FROM ( VALUES ( (true), ( true ) ) )t(a);
>
> END $$;
>
> i would argue, that thats a way more common usecase than the union, which
> was merely bad code.
>
What is the sense of this code?
This is strange with not well defined behavior (in dependency on data type
the result can depend on collate).
More - because this breaks simple expression optimization (10x), then the
code will be significantly slower, than you use IF or CASE.
Regards
Pavel
> tested with version 14~~devel~20210111.0540-1~299.gitce6a71f.pgdg110+1
> from the apt repo
>
> with kind redards,
> richard
>
From | Date | Subject | |
---|---|---|---|
Next Message | Joel Jacobson | 2021-01-22 08:47:28 | Re: Add primary keys to system catalogs |
Previous Message | Bharath Rupireddy | 2021-01-22 08:33:08 | Re: Logical Replication - behavior of ALTER PUBLICATION .. DROP TABLE and ALTER SUBSCRIPTION .. REFRESH PUBLICATION |