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

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: BUG #5867: wish: plpgsql print table for debug
Дата
Msg-id AANLkTi=Yd-BwdsziHE-eyK9M5DvMy+FYqs2YUd9dgxQ3@mail.gmail.com
обсуждение исходный текст
Ответ на Re: BUG #5867: wish: plpgsql print table for debug  (Richard Neill <rn214@richardneill.org>)
Ответы Re: BUG #5867: wish: plpgsql print table for debug  (Richard Neill <rjn@richardneill.org>)
Список pgsql-bugs
Hello

>
> Do you not think it would be really amazingly useful? After all, in C, the
> single most useful debugging tool is "fprintf(stderr,...)", and yet
> postgresql doesn't have an equivalent that can operate on the most common
> data format. [I'm stretching the analogy a bit here, but it seems to me that
> a multi-row table is to postgresql as int is to C.]

it's nonsense - PL/pgSQL is procedural language - so there are same -
similar types like C

>
> There are a lot of people who would benefit from it, most of whom (including
> me) don't really have the expertise to do it well.
>

I don't think so we need a special enhancing of RAISE statement. What
is a problem on lines

FOR r IN SELECT ... LOOP
  RAISE NOTICE r;
END LOOP;

???

> Also, there is a lot of value in being able to debug as needed with a 1-line
> debugging statement, then get back to the problem at hand, rather than
> having to break out of the current programming task to write a debug
> function :-)
>

CREATE OR REPLACE FUNCTION debug_query(text)
RETURNS void AS $$
DECLARE r record;
BEGIN
  FOR r IN EXECUTE $1 LOOP
    RAISE NOTICE r;
  END;
END;
$$ LANGUAGE plpgsql;

Regards

Pavel Stehule


> Thanks very much,
>
> Richard
>
>
> --
> Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-bugs
>

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BUG #5912: Etc/GMT time utc offset error
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #5906: assertion failure in AtCleanup_Portals