Re: BUG #5867: wish: plpgsql print table for debug

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: BUG #5867: wish: plpgsql print table for debug
Дата
Msg-id AANLkTimrzAYxjqFaKRjmVvXiVt_YuAVG54C9EcNW95db@mail.gmail.com
обсуждение исходный текст
Ответ на BUG #5867: wish: plpgsql print table for debug  ("Richard Neill" <postgresql@richardneill.org>)
Ответы Re: BUG #5867: wish: plpgsql print table for debug  (Richard Neill <rn214@richardneill.org>)
Список pgsql-bugs
On Mon, Feb 7, 2011 at 1:01 AM, Richard Neill
<postgresql@richardneill.org> wrote:
>
> The following bug has been logged online:
>
> Bug reference: =A0 =A0 =A05867
> Logged by: =A0 =A0 =A0 =A0 =A0Richard Neill
> Email address: =A0 =A0 =A0postgresql@richardneill.org
> PostgreSQL version: 9.03
> Operating system: =A0 Linux
> Description: =A0 =A0 =A0 =A0wish: plpgsql print table for debug
> Details:
>
> When debugging a plpgsql function, it would be really amazingly useful to=
 be
> able to do a regular psql-style SELECT, and have the result printed to
> screen.
>
> Something like:
>
> =A0 Raise Notice table 'SELECT .... '
>
> and then plpgsql would run the query and dump the result to screen, using
> its helpful formatting.
>
> As far as I can see, this isn't possible (though there are a lot of people
> searching for how to do it), and the only workaround is to manually handle
> the looping and formatting, raising lots of individual notices. This makes
> debugging much harder than it should be.

It wouldn't be too hard to write a loop that runs the select statement
and does RAISE NOTICE on each row.  Getting that into the psql
formatting would be a little trickier, but I don't see why you
couldn't write a PL/pgsql function to do it.  Then you could just call
that function and pass it an SQL query every time you want to do this.

--=20
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: BUG #5863: help message report 5433 as default port
Следующее
От: Robert Haas
Дата:
Сообщение: Re: BUG #5871: database connecting failed