Re: Feature Idea: Statement Echo in DO$$

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: Feature Idea: Statement Echo in DO$$
Дата
Msg-id CAFj8pRAWE7Yqw+KCw4VcwVi0VY=rRq29Ruh33hwgNyf+Y_QetQ@mail.gmail.com
обсуждение исходный текст
Ответ на Feature Idea: Statement Echo in DO$$  (David Johnston <polobo@yahoo.com>)
Список pgsql-general
Hello

2013/7/3 David Johnston <polobo@yahoo.com>:
> I am using a DO$$ $$ block to emulate something that admittedly may be
> standard practice to accomplish using psql but for which I am using a less
> capable UI.
>
> Anyway, the basic form is:
>
> DO $$
> DECLARE some_var varchar := 'value';
> BEGIN
>
> UPDATE ..... WHERE col = some_var;
> UPDATE ..... WHERE col = some_var;
>
> RETURN;
> END;
> $$
>
> Now because of the DO I have no idea how many records were affected for each
> of the UPDATE statements.  I am thinking that, either at the statement-level
> or even somehow defined inside the DO, some way to have the system
> automatically echo the usual "0 records updated" message out of the DO.
>
> i.e., UPDATE (VERBOSE) .... SET id = some_var;
>
> GET DIAGNOSTICS obviously works, and for a stored function is probably the
> better option, but for a simple DO oriented script command it is quite
> verbose.
>
> There is a prior discussion (somewhere) regarding using STRICT without
> RETURNING in similar situations to easily define when only one (and only
> one) record is expected to be affected.  This thought falls into the same
> usability category.
>
> Thoughts?

I dislike this proposal

syntax is common for DO and functions, and it is useless there.

Probably we can enhance a messages in DEBUG level (or we can create a
new level of debug notices for this purposes).

I am afraid, there is no some workaround :(

Regards

Pavel Stehule



>
> David J.
>
>
>
>
>
>
> --
> View this message in context:
http://postgresql.1045698.n5.nabble.com/Feature-Idea-Statement-Echo-in-DO-tp5762454.html
> Sent from the PostgreSQL - general mailing list archive at Nabble.com.
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general


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

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: Cannot connect to remote postgres database
Следующее
От: John R Pierce
Дата:
Сообщение: Re: Cannot connect to remote postgres database