Re: [RFC] Add an until-0 loop in psql

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
Cc: Pierre Ducroquet <pierre(dot)ducroquet(at)people-doc(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [RFC] Add an until-0 loop in psql
Date: 2018-04-29 03:35:48
Message-ID: CAFj8pRA8_sPSyoLdEhRa5yTT5d-fwc_wDO1mjRKdaP_=U6UiyA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2018-04-28 21:25 GMT+02:00 Corey Huinker <corey(dot)huinker(at)gmail(dot)com>:

>
>> I did it too. It is not too hard - there was not a agreement on syntax.
>>
>> can be nice some like CTE
>>
>> WITH PROCEDURE x(a int, b int) AS ... $$ SELECT x(10);
>>
>
> I've seen "WITH function...." syntax in Oracle (here's an example:
> https://oracle-base.com/articles/12c/with-clause-enhancements-12cr1) ,
> but I can see where we'd run into trouble with SELECT statements being
> atomic, and the PROCEDURE being transactional. If we only allowed a
> one-line SELECT that problem would go away, but that raises the question of
> whether SELECT is the right keyword for the job. Is there something in the
> SQL standard for that?
>

My example was wrong

WITH PROCEDURE x(a int, b int) AS ... $$ CALL x(10);

but still, we can use different syntax based on default parameters -

DO (a => 10, b => 20) $$ ... $$

probably implementation should not be hard.

Either way, we're clearly talking about something to add to postgres, not
> psql itself, and we should split this conversation to another thread. Sorry
> for hijacking your thread, Pierre.
>

+1 we can start new thread if is interest about this topic. The problem is
just in syntax, nothing else.

note: DO is executed as function if I remember well, not as procedure! So
this should be changed.

Regards

Pavel

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Charles Cui 2018-04-29 06:12:30 GSoC 2018: thrift encoding format
Previous Message Craig Ringer 2018-04-29 01:58:45 Re: Postgres, fsync, and OSs (specifically linux)