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

Поиск
Список
Период
Сортировка
От Pierre Ducroquet
Тема Re: [RFC] Add an until-0 loop in psql
Дата
Msg-id 1774744.xorj2R6y5C@pierred-pdoc
обсуждение исходный текст
Ответ на Re: [RFC] Add an until-0 loop in psql  ("Daniel Verite" <daniel@manitou-mail.org>)
Ответы Re: [RFC] Add an until-0 loop in psql  (Corey Huinker <corey.huinker@gmail.com>)
Список pgsql-hackers
On Monday, April 30, 2018 1:01:25 PM CEST Daniel Verite wrote:
>     Corey Huinker wrote:
> > As of v11, DO blocks can do transactions. I think this will meet your
> > needs.
> They do support COMMIT and ROLLBACK in the current
> development tree, but not VACUUM as in Pierre's example.
>
> postgres=# \echo :SERVER_VERSION_NAME
> 11devel
>
> postgres=# do ' begin vacuum; end ';
> ERROR:    VACUUM cannot be executed from a function
> CONTEXT:  SQL statement "vacuum"
> PL/pgSQL function inline_code_block line 1 at SQL statement
>
>
> Best regards,

Indeed, vacuum is going to be the biggest offender here, sadly.
One could work around this of course (on top of my head, using notify to wake-
up another client that would launch the required vacuums…)
Being able to do transactions in DO blocks is a great new feature of v11 I was
not aware of. But psql saw the addition of \if recently, so why not having
loops in there too ? (Something better than this hack of course, it was just a
10 minutes hack-sprint for a demo)

Regards

 Pierre




В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Daniel Verite"
Дата:
Сообщение: Re: [RFC] Add an until-0 loop in psql
Следующее
От: Markus Winand
Дата:
Сообщение: Re: XML/XPath issues: text/CDATA in XMLTABLE, XPath evaluated with wrong context