Skip site navigation (1) Skip section navigation (2)

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 04:01:58
Message-ID: 20060106040158.GA81499@winnie.fuhr.org (view raw or flat)
Thread:
Lists: pgsql-interfaces
[Please post in plain text, not HTML.]

On Fri, Jan 06, 2006 at 10:15:19AM +0800, JiangWei wrote:
> > 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);

I'm not aware of a way to get just the column name, so if nobody
else posts a way then you might have to parse the error message
(admittedly a pain, especially if you have to deal with different
languages).

-- 
Michael Fuhr

In response to

Responses

pgsql-interfaces by date

Next:From: Jeroen T. VermeulenDate: 2006-01-06 04:19:56
Subject: Re: [C API] Is there a nice way to get table/column
Previous:From: JiangWeiDate: 2006-01-06 02:15:19
Subject: Re: [C API] Is there a nice way to get table/column

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group