Re: Re: Support plpgsql multi-range in conditional control

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: songjinzhou <2903807914(at)qq(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Re: Support plpgsql multi-range in conditional control
Date: 2023-01-25 17:02:07
Message-ID: CAFj8pRCdyNz9sSTPpKnTEo3JBj03x+GrChpoXQvQFR7OUAxuJA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

st 25. 1. 2023 v 17:22 odesílatel songjinzhou <2903807914(at)qq(dot)com> napsal:

>
> >Hi
>
> >st 25. 1. 2023 v 16:39 odesílatel songjinzhou <2903807914(at)qq(dot)com>
> napsal: Hello, my personal understanding is that you can use multiple
> iterative controls (as a merge) in a fo loop, otherwise we can only
> separate these iterative controls, but in fact, they may do the same thing.
>
> >1. please, don't use top posting in this mailing list
> https://en.wikipedia.org/wiki/Posting_styl
>
> >2. I understand the functionality, but I don't think there is a real
> necessity to support this functionality. Not in this static form, and just
> for integer type.
>
> >Postgres has a nice generic type "multirange". I can imagine some
> iterator over the value of multirange, but I cannot imagine the necessity
> of a richer iterator over just integer range. So the question is, what is
> the real possible use case of this proposed functionality?
>
> 1. I'm very sorry that my personal negligence has caused obstacles to your
> reading. Thank you for your reminding.
> 2. With regard to the use of this function, my understanding is relatively
> simple: there are many for loops that may do the same things. We can reduce
> our sql redundancy by merging iterative control; It is also more convenient
> to understand and read logically.
>
> As follows, we can only repeat the for statement before we use such SQL:
>
> begin
> for i in 10..20 loop
> raise notice '%', i; -- Things to do
> end loop;
>
> for i in 100 .. 200 by 10 loop
> raise notice '%', i; -- Things to do
> end loop;
> end;
>
> But now we can simplify it as follows:
>
> begin
> for i in 10..20, 100 .. 200 by 10 loop
> raise notice '%', i; -- Things to do
> end loop;
> end;
>
> Although we can only use integer iterative control here, this is just a
> horizontal expansion of the previous logic. Thank you very much for your
> reply. I am very grateful!
>
>
Unfortunately, this is not a real use case - this is not an example from
the real world.

Regards

Pavel

> ---
>
> songjinzhou(2903807914(at)qq(dot)com)
>
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jacob Champion 2023-01-25 17:09:47 Re: Authentication fails for md5 connections if ~/.postgresql/postgresql.{crt and key} exist
Previous Message Tom Lane 2023-01-25 16:49:27 Re: wake up logical workers after ALTER SUBSCRIPTION