Thread: Huh? ErrorCode/SQLstate are null?

Huh? ErrorCode/SQLstate are null?

From
beh@icemark.net
Date:
Hi there,

  how can I actually find out more about an SQL error except by
looking at the message in an exception?

  If I try to insert into a non-existing relation or an insert
generates a duplicate key, the thrown SQLException yields SQLstate
null and ErrorCode 0...  Just the result from
SQLException.getMessage() seems to make sense...


I am using postresql-7.2.1-2 from Debian "testing" on linux-i386.
The error occurs on both the current libpgjava package as well as
the latest beta driver (pg73b1jdbc3.jar) from jdbc.postgresql.org.


Is that behaviour 'normal' in the postgresql JDBC driver?
Or is there some problem with the setup on my side?


        Benedikt

  BEAUTY, n.  The power by which a woman charms a lover and terrifies a
    husband.
            (Ambrose Bierce, The Devil's Dictionary)


Re: Huh? ErrorCode/SQLstate are null?

From
Barry Lind
Date:
Please see the many past posts in the archives on this topic.  But the
short answer is: the postgres server doesn't yet support error codes and
therefore neither does the jdbc driver.  It is on the todo list for both
however, but no one has yet stepped up to implement it.

--Barry

beh@icemark.net wrote:
 > Hi there,
 >
 >   how can I actually find out more about an SQL error except by
 > looking at the message in an exception?
 >
 >   If I try to insert into a non-existing relation or an insert
 > generates a duplicate key, the thrown SQLException yields SQLstate
 > null and ErrorCode 0...  Just the result from
 > SQLException.getMessage() seems to make sense...
 >
 >
 > I am using postresql-7.2.1-2 from Debian "testing" on linux-i386.
 > The error occurs on both the current libpgjava package as well as
 > the latest beta driver (pg73b1jdbc3.jar) from jdbc.postgresql.org.
 >
 >
 > Is that behaviour 'normal' in the postgresql JDBC driver?
 > Or is there some problem with the setup on my side?
 >
 >
 >         Benedikt
 >
 >   BEAUTY, n.  The power by which a woman charms a lover and terrifies a
 >     husband.
 >             (Ambrose Bierce, The Devil's Dictionary)
 >
 >
 > ---------------------------(end of broadcast)---------------------------
 > TIP 4: Don't 'kill -9' the postmaster
 >



Re: Huh? ErrorCode/SQLstate are null?

From
Dror Matalon
Date:
Hi,

Follow up to this question, not really JDBC specific. Is there a
specific centralized location for the error messages, or are these just
inline in different parts of the postmaster code?
Also, how likely is it that the error string would change between
versions?

In other words, if I want to check for
 Relation "adb_email" does not exist
So that I can conver it to
    There is no "adb_email" table in the database

Would I be running the chance that in the next version the error message
is going to change?
Is this a bad idea?


On Wed, Oct 02, 2002 at 09:27:31AM -0700, Barry Lind wrote:
> Please see the many past posts in the archives on this topic.  But the
> short answer is: the postgres server doesn't yet support error codes and
> therefore neither does the jdbc driver.  It is on the todo list for both
> however, but no one has yet stepped up to implement it.
>
> --Barry
>
> beh@icemark.net wrote:
> > Hi there,
> >
> >   how can I actually find out more about an SQL error except by
> > looking at the message in an exception?
> >
> >   If I try to insert into a non-existing relation or an insert
> > generates a duplicate key, the thrown SQLException yields SQLstate
> > null and ErrorCode 0...  Just the result from
> > SQLException.getMessage() seems to make sense...
> >
> >
> > I am using postresql-7.2.1-2 from Debian "testing" on linux-i386.
> > The error occurs on both the current libpgjava package as well as
> > the latest beta driver (pg73b1jdbc3.jar) from jdbc.postgresql.org.
> >
> >
> > Is that behaviour 'normal' in the postgresql JDBC driver?
> > Or is there some problem with the setup on my side?
> >
> >
> >         Benedikt
> >
> >   BEAUTY, n.  The power by which a woman charms a lover and terrifies a
> >     husband.
> >             (Ambrose Bierce, The Devil's Dictionary)
> >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 4: Don't 'kill -9' the postmaster
> >
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org

--
Dror Matalon
Zapatec Inc
1700 MLK Way
Berkeley, CA 94709
http://www.zapatec.com

Re: Huh? ErrorCode/SQLstate are null?

From
Dave Cramer
Date:
Dror,

They should be in a properties file, if they aren't they need to be.

Dave
On Wed, 2002-10-02 at 13:32, Dror Matalon wrote:
> Hi,
>
> Follow up to this question, not really JDBC specific. Is there a
> specific centralized location for the error messages, or are these just
> inline in different parts of the postmaster code?
> Also, how likely is it that the error string would change between
> versions?
>
> In other words, if I want to check for
>  Relation "adb_email" does not exist
> So that I can conver it to
>     There is no "adb_email" table in the database
>
> Would I be running the chance that in the next version the error message
> is going to change?
> Is this a bad idea?
>
>
> On Wed, Oct 02, 2002 at 09:27:31AM -0700, Barry Lind wrote:
> > Please see the many past posts in the archives on this topic.  But the
> > short answer is: the postgres server doesn't yet support error codes and
> > therefore neither does the jdbc driver.  It is on the todo list for both
> > however, but no one has yet stepped up to implement it.
> >
> > --Barry
> >
> > beh@icemark.net wrote:
> > > Hi there,
> > >
> > >   how can I actually find out more about an SQL error except by
> > > looking at the message in an exception?
> > >
> > >   If I try to insert into a non-existing relation or an insert
> > > generates a duplicate key, the thrown SQLException yields SQLstate
> > > null and ErrorCode 0...  Just the result from
> > > SQLException.getMessage() seems to make sense...
> > >
> > >
> > > I am using postresql-7.2.1-2 from Debian "testing" on linux-i386.
> > > The error occurs on both the current libpgjava package as well as
> > > the latest beta driver (pg73b1jdbc3.jar) from jdbc.postgresql.org.
> > >
> > >
> > > Is that behaviour 'normal' in the postgresql JDBC driver?
> > > Or is there some problem with the setup on my side?
> > >
> > >
> > >         Benedikt
> > >
> > >   BEAUTY, n.  The power by which a woman charms a lover and terrifies a
> > >     husband.
> > >             (Ambrose Bierce, The Devil's Dictionary)
> > >
> > >
> > > ---------------------------(end of broadcast)---------------------------
> > > TIP 4: Don't 'kill -9' the postmaster
> > >
> >
> >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 6: Have you searched our list archives?
> >
> > http://archives.postgresql.org
>
> --
> Dror Matalon
> Zapatec Inc
> 1700 MLK Way
> Berkeley, CA 94709
> http://www.zapatec.com
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
>
>




Re: Huh? ErrorCode/SQLstate are null?

From
Dror Matalon
Date:
They should be but they aren't. I looked at the backend code, and
they're hard coded. The good news is that the translation effort of the
mssages in the po directory has already done the work of finding the
error messages. The bad news is that there are over 12,000 entries in
that file so it would be quite a task to find the "harmless" messages
like "Cannot insert a duplicate key into unique index."

On Thu, Oct 03, 2002 at 07:48:08AM -0400, Dave Cramer wrote:
> Dror,
>
> They should be in a properties file, if they aren't they need to be.
>
> Dave
> On Wed, 2002-10-02 at 13:32, Dror Matalon wrote:
> > Hi,
> >
> > Follow up to this question, not really JDBC specific. Is there a
> > specific centralized location for the error messages, or are these just
> > inline in different parts of the postmaster code?
> > Also, how likely is it that the error string would change between
> > versions?
> >
> > In other words, if I want to check for
> >  Relation "adb_email" does not exist
> > So that I can conver it to
> >     There is no "adb_email" table in the database
> >
> > Would I be running the chance that in the next version the error message
> > is going to change?
> > Is this a bad idea?
> >
> >
> > On Wed, Oct 02, 2002 at 09:27:31AM -0700, Barry Lind wrote:
> > > Please see the many past posts in the archives on this topic.  But the
> > > short answer is: the postgres server doesn't yet support error codes and
> > > therefore neither does the jdbc driver.  It is on the todo list for both
> > > however, but no one has yet stepped up to implement it.
> > >
> > > --Barry
> > >
> > > beh@icemark.net wrote:
> > > > Hi there,
> > > >
> > > >   how can I actually find out more about an SQL error except by
> > > > looking at the message in an exception?
> > > >
> > > >   If I try to insert into a non-existing relation or an insert
> > > > generates a duplicate key, the thrown SQLException yields SQLstate
> > > > null and ErrorCode 0...  Just the result from
> > > > SQLException.getMessage() seems to make sense...
> > > >
> > > >
> > > > I am using postresql-7.2.1-2 from Debian "testing" on linux-i386.
> > > > The error occurs on both the current libpgjava package as well as
> > > > the latest beta driver (pg73b1jdbc3.jar) from jdbc.postgresql.org.
> > > >
> > > >
> > > > Is that behaviour 'normal' in the postgresql JDBC driver?
> > > > Or is there some problem with the setup on my side?
> > > >
> > > >
> > > >         Benedikt
> > > >
> > > >   BEAUTY, n.  The power by which a woman charms a lover and terrifies a
> > > >     husband.
> > > >             (Ambrose Bierce, The Devil's Dictionary)
> > > >
> > > >
> > > > ---------------------------(end of broadcast)---------------------------
> > > > TIP 4: Don't 'kill -9' the postmaster
> > > >
> > >
> > >
> > >
> > > ---------------------------(end of broadcast)---------------------------
> > > TIP 6: Have you searched our list archives?
> > >
> > > http://archives.postgresql.org
> >
> > --
> > Dror Matalon
> > Zapatec Inc
> > 1700 MLK Way
> > Berkeley, CA 94709
> > http://www.zapatec.com
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 3: if posting/reading through Usenet, please send an appropriate
> > subscribe-nomail command to majordomo@postgresql.org so that your
> > message can get through to the mailing list cleanly
> >
> >
>
>
>

--
Dror Matalon
Zapatec Inc
1700 MLK Way
Berkeley, CA 94709
http://www.zapatec.com

Re: Huh? ErrorCode/SQLstate are null?

From
Barry Lind
Date:
Dror,

The error messages are sort of inline with the backend server code,
however they can be translated (see src/backend/po/*).

The error strings probably won't change between releases, however
depending on language settings you may end up with totally different
strings for the same error condition.

thanks,
--Barry


Dror Matalon wrote:
 > Hi,
 >
 > Follow up to this question, not really JDBC specific. Is there a
 > specific centralized location for the error messages, or are these just
 > inline in different parts of the postmaster code?
 > Also, how likely is it that the error string would change between
 > versions?
 >
 > In other words, if I want to check for
 >  Relation "adb_email" does not exist
 > So that I can conver it to
 >     There is no "adb_email" table in the database
 >
 > Would I be running the chance that in the next version the error message
 > is going to change?
 > Is this a bad idea?
 >
 >
 > On Wed, Oct 02, 2002 at 09:27:31AM -0700, Barry Lind wrote:
 >
 >>Please see the many past posts in the archives on this topic.  But the
 >>short answer is: the postgres server doesn't yet support error codes and
 >>therefore neither does the jdbc driver.  It is on the todo list for both
 >>however, but no one has yet stepped up to implement it.
 >>
 >>--Barry
 >>
 >>beh@icemark.net wrote:
 >>
 >>>Hi there,
 >>>
 >>>  how can I actually find out more about an SQL error except by
 >>>looking at the message in an exception?
 >>>
 >>>  If I try to insert into a non-existing relation or an insert
 >>>generates a duplicate key, the thrown SQLException yields SQLstate
 >>>null and ErrorCode 0...  Just the result from
 >>>SQLException.getMessage() seems to make sense...
 >>>
 >>>
 >>>I am using postresql-7.2.1-2 from Debian "testing" on linux-i386.
 >>>The error occurs on both the current libpgjava package as well as
 >>>the latest beta driver (pg73b1jdbc3.jar) from jdbc.postgresql.org.
 >>>
 >>>
 >>>Is that behaviour 'normal' in the postgresql JDBC driver?
 >>>Or is there some problem with the setup on my side?
 >>>
 >>>
 >>>        Benedikt
 >>>
 >>>  BEAUTY, n.  The power by which a woman charms a lover and terrifies a
 >>>    husband.
 >>>            (Ambrose Bierce, The Devil's Dictionary)
 >>>
 >>>
 >>>---------------------------(end of broadcast)---------------------------
 >>>TIP 4: Don't 'kill -9' the postmaster
 >>>
 >>
 >>
 >>
 >>---------------------------(end of broadcast)---------------------------
 >>TIP 6: Have you searched our list archives?
 >>
 >>http://archives.postgresql.org
 >
 >