Обсуждение: plpython docs should say 'plpy.Error' instead of ERROR

Поиск
Список
Период
Сортировка

plpython docs should say 'plpy.Error' instead of ERROR

От
Marti Raudsepp
Дата:
Currently the PL/Python documentation claims that:
"raise plpy.ERROR(msg) and raise plpy.FATAL(msg) are equivalent to
calling plpy.error and plpy.fatal, respectively"

However, the actual names are Error and Fatal, not ERROR or FATAL
(Python is case-sensitive). Patch to fix documentation attached.

postgres=# CREATE OR REPLACE FUNCTION public.foo() RETURNS void
LANGUAGE plpythonu AS 'raise plpy.ERROR("foobar happened!")';
CREATE FUNCTION
postgres=# select foo();
ERROR:  PL/Python: AttributeError: 'module' object has no attribute 'ERROR'
CONTEXT:  PL/Python function "foo"

postgres=# CREATE OR REPLACE FUNCTION public.foo() RETURNS void
LANGUAGE plpythonu AS 'raise plpy.Error("foobar happened!")';
CREATE FUNCTION
postgres=# select foo();
ERROR:  PL/Python: plpy.Error: foobar happened!
CONTEXT:  PL/Python function "foo"

Regards,
Marti

Вложения

Re: plpython docs should say 'plpy.Error' instead of ERROR

От
Alvaro Herrera
Дата:
Excerpts from Marti Raudsepp's message of mar nov 09 07:21:54 -0300 2010:
> Currently the PL/Python documentation claims that:
> "raise plpy.ERROR(msg) and raise plpy.FATAL(msg) are equivalent to
> calling plpy.error and plpy.fatal, respectively"
>
> However, the actual names are Error and Fatal, not ERROR or FATAL
> (Python is case-sensitive). Patch to fix documentation attached.

Thanks, pushed to 9.0 and HEAD.

--
Álvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support