Обсуждение: pgsql: Implement two new special variables in PL/PgSQL: SQLSTATE and

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

pgsql: Implement two new special variables in PL/PgSQL: SQLSTATE and

От
neilc@svr1.postgresql.org (Neil Conway)
Дата:
Log Message:
-----------
Implement two new special variables in PL/PgSQL: SQLSTATE and SQLERRM.
These contain the SQLSTATE and error message of the current exception,
respectively. They are scope-local variables that are only defined
in exception handlers (so attempting to reference them outside an
exception handler is an error). Update the regression tests and the
documentation.

Also, do some minor related cleanup: export an unpack_sql_state()
function from the backend and use it to unpack a SQLSTATE into a
string, and add a free_var() function to pl_exec.c

Original patch from Pavel Stehule, review by Neil Conway.

Modified Files:
--------------
    pgsql/doc/src/sgml:
        plpgsql.sgml (r1.70 -> r1.71)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/plpgsql.sgml.diff?r1=1.70&r2=1.71)
    pgsql/src/backend/utils/error:
        elog.c (r1.159 -> r1.160)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/error/elog.c.diff?r1=1.159&r2=1.160)
    pgsql/src/include/utils:
        elog.h (r1.78 -> r1.79)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/utils/elog.h.diff?r1=1.78&r2=1.79)
    pgsql/src/pl/plpgsql/src:
        gram.y (r1.74 -> r1.75)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/pl/plpgsql/src/gram.y.diff?r1=1.74&r2=1.75)
        pl_comp.c (r1.90 -> r1.91)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/pl/plpgsql/src/pl_comp.c.diff?r1=1.90&r2=1.91)
        pl_exec.c (r1.142 -> r1.143)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/pl/plpgsql/src/pl_exec.c.diff?r1=1.142&r2=1.143)
        pl_funcs.c (r1.40 -> r1.41)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/pl/plpgsql/src/pl_funcs.c.diff?r1=1.40&r2=1.41)
        plpgsql.h (r1.61 -> r1.62)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/pl/plpgsql/src/plpgsql.h.diff?r1=1.61&r2=1.62)
    pgsql/src/test/regress/expected:
        plpgsql.out (r1.32 -> r1.33)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/expected/plpgsql.out.diff?r1=1.32&r2=1.33)
    pgsql/src/test/regress/sql:
        plpgsql.sql (r1.27 -> r1.28)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/sql/plpgsql.sql.diff?r1=1.27&r2=1.28)