Re: [C API] Is there a nice way to get table/column name on some error ?

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: JiangWei <jw(dot)pgsql(at)sduept(dot)com>
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: [C API] Is there a nice way to get table/column name on some error ?
Date: 2006-01-06 02:11:49
Message-ID: 20060106021149.GA80657@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

[Please post in plain text, not HTML.]

On Fri, Jan 06, 2006 at 09:32:36AM +0800, JiangWei wrote:
> 42703 UNDEFINED COLUMN undefined_column
> 42883 UNDEFINED FUNCTION undefined_function
> 42P01 UNDEFINED TABLE undefined_table
>
> I want to know which column undefined when "undefined_column" Happen
> at run time.

With libpq you can call PQerrorMessage(), PQresultErrorMessage(),
or PQresultErrorField() to get a string that should identify the
offending column, function, table, etc. Will that work for your
purpose?

--
Michael Fuhr

In response to

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message JiangWei 2006-01-06 02:15:19 Re: [C API] Is there a nice way to get table/column
Previous Message JiangWei 2006-01-06 01:32:36 [C API] Is there a nice way to get table/column name on some error ?