Fix errcontext() function

From: Chen Huajun <chenhj(at)cn(dot)fujitsu(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Fix errcontext() function
Date: 2012-11-08 05:59:58
Message-ID: 509B4A5E.7010307@cn.fujitsu.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

I am sending patch for errcontext() function.

I use procedural languages to do some operation, but when error occurs
,the CONTEXT error messages from procedural languages doesn't display in
local language.

for example:
--------------------------------------------------------
postgres=# CREATE OR REPLACE FUNCTION logfunc3 (logtxt text) RETURNS
timestamp AS $$
postgres$# BEGIN
postgres$# select * from db;
postgres$# RETURN 'now';
postgres$# END;
postgres$# $$ LANGUAGE plpgsql;
CREATE FUNCTION
postgres=# select logfunc3('test');
ERROR: リレーション"db"は存在しません
行 1: select * from db
QUERY: select * from db
CONTEXT: PL/pgSQL function "logfunc3" line 3 at SQL ステートメント
--------------------------------------------------------
but,“CONTEXT: PL/pgSQL 関数 "logfunc3" の 3 行目の型 SQL ステートメント” is my expected.

There is the same problem in pl/perl and pl/python .

After checking and debuging the source code ,I found the reason.

The reason is that domian setted is wrong. For PL/pgSQL, domain "pgsql" should be setted, but domain setted is "postgres" .

So I considered to fix the bug by updating errcontext() funtion.

The patched portion is at src/include/utils/elog.h and
src/backend/utils/error/elog.c

I invite any ideas how to improve this patch.

Best Regards

Huajun Chen

Attachment Content-Type Size
elog_c.diff text/plain 2.7 KB
elog_h.diff text/plain 1.1 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2012-11-08 06:22:15 Re: RFC: New log_destination 'fifo'
Previous Message Tom Lane 2012-11-08 05:03:12 Re: commit 1eb1dde049ccfffc42c80c2 broke make -j2