X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B05229DC9FF for ; Thu, 5 Jan 2006 22:17:29 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 66455-03 for ; Thu, 5 Jan 2006 22:17:33 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from hp.sduept.com (unknown [60.208.83.220]) by postgresql.org (Postfix) with ESMTP id 87CE69DC802 for ; Thu, 5 Jan 2006 22:17:26 -0400 (AST) Received: from [192.168.1.36] (soft36.sduept.com [192.168.1.36]) by hp.sduept.com (8.13.1/8.13.1) with ESMTP id k062FJBf017719; Fri, 6 Jan 2006 10:15:20 +0800 Message-ID: <43BDD2B7.2090609@sduept.com> Date: Fri, 06 Jan 2006 10:15:19 +0800 From: JiangWei User-Agent: Mozilla Thunderbird 1.0.7-1.1.fc4 (X11/20050929) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Michael Fuhr CC: pgsql-interfaces@postgresql.org Subject: Re: [C API] Is there a nice way to get table/column References: <43BDC8B4.6020801@sduept.com> <20060106021149.GA80657@winnie.fuhr.org> In-Reply-To: <20060106021149.GA80657@winnie.fuhr.org> Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.113 required=5 tests=[AWL=0.111, HTML_MESSAGE=0.001, MIME_HTML_ONLY=0.001] X-Spam-Score: 0.113 X-Spam-Level: X-Archive-Number: 200601/5 X-Sequence-Number: 5921 Michael Fuhr wrote:
[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?

  
No.  I want to throw a exception with  the column name, like this :

if (sqlstate == undefined_column)
  throw UnknownProperty(column_name);