Hi!
I started programming PostgreSQL database with libpq API (client
side). It looks very easy, but unexpected I found problem, which I
cannot solve myself.
If function PQexec fails, I can get error code using PQresultStatus.
But returned codes are very generally and do not specify what really
happen. I can get detailed error description using PQerrorMessage
function, but I need detailed error code (number).
For instance, if I create table, I would like to know, that operation
failed because:
- table already exist
- sql syntax error
- invalid columnt type
and so on.
I searched documents about libpq API and even header file
'internal/libpq-int.h' but I didn't found any interesting.
I would be very gracefully for any hint.
Best regards,
Adam Bukla 3 2996 Ad********@inte ria.pl wrote: ...
If function PQexec fails, I can get error code using PQresultStatus. But returned codes are very generally and do not specify what really happen. I can get detailed error description using PQerrorMessage function, but I need detailed error code (number).
For instance, if I create table, I would like to know, that operation failed because: - table already exist - sql syntax error - invalid columnt type and so on.
I searched documents about libpq API and even header file 'internal/libpq-int.h' but I didn't found any interesting.
I would be very gracefully for any hint.
Appendix A of the PostgreSQL 7.4.1 Reference Manual has a list of error
codes (5 digit numbers) and their meanings. You get at the error code
with PQresultErrorFi eld(result, PG_DIAG_SQLSTAT E). Ad********@inte ria.pl (Adam Bukla) writes: If function PQexec fails, I can get error code using PQresultStatus. But returned codes are very generally and do not specify what really happen. I can get detailed error description using PQerrorMessage function, but I need detailed error code (number).
Beginning in Postgres 7.4, there are standard SQLSTATE error codes
available (see PQresultErrorFi eld), but older releases do not have them.
regards, tom lane
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postg resql.org
Hi!
Thanks ljb and Tom Lane - it's exactly what I wanted.
I read documentation to 7.3 so I couldn't find PQresultErrorFi eld function.
I'm suprised, that such necessary functionality exist only in 7.4 version.
Thanks once again,
Adam Bukla This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Juho Saarikko |
last post by:
I made a Python script which takes Usenet message bodies from a database,
decodes uuencoded contents and inserts them as Large Object into a
PostGreSQL database. However, it appears that the to last few bytes
of uudecoded data are always mangled. Take a look of this hexdump output:
Originals (decoded with Pan, each line is from a different...
|
by: Marco Vezzoli |
last post by:
Hi all,
I'm using
solaris 8
gcc 3.0.1
postgres 7.3.4
psycopg 1.1.2
apache 1.3.19
python 2.1.1
mod_python 2.7.8 compiled with DSO
|
by: Richard Welty |
last post by:
ok, i'm confused.
i have two systems. one is redhat 7.1 (a server in colo, reasonably
current), the other is 8.0 (my laptop). the server in colo is running
postgresql 7.3.2 along with redhat's updated versions of apache and php for
7.1 (the php version is 4.1.2) on this server, php can access postgres
without difficulty.
my laptop is...
|
by: Saravanan A |
last post by:
Hello All,
I am having the following problem in PostgreSQL build
process. If anyone came across this, pls give me a
solution to solve this.
I followed the steps below given at the build time.
1) postgresql-7.3.5 source files are downloaded from
postgresql.org
|
by: Jim Crate |
last post by:
I'm trying to build a client program to access a database using the libpq
interface on MacOS X 10.3.3 using CodeWarrior 9. PostgreSQL is at version
7.4.2.
It compiles ok, but I get a link error. I have linked to libpq.a, because I got
different errors before I did that. Here is the error I'm getting right now:
Link Error: undefined:...
| |
by: Adam Smith |
last post by:
Installation of 7.4.2, even with just ./configure : gmake step ==>
_________________________________________________
gmake: Leaving directory
`/usr/home/smith/Temp_holding/staging-area/postgresql/postgresql-7.4.2/src/backend/parser'
gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
-Wmissing-declarations pg_dump.o common.o...
|
by: Wayne Fang |
last post by:
Hi,
For various reasons (parallel structure with existing code, commonality of concepts, etc), we have C language functions implemented that use libpq to make a new connection to the same Postgres server. Yes, I realize libpq is meant for clients and SPI for backends. The question is, are there any technical problems with this? Will using...
|
by: Vidyasagara Guntaka |
last post by:
Hi,
I recently downloaded source code for 8.0.0 beta1. When I tried building the libpq for windows, I got some compilation errors. Following the compilation output:
C:\temp\postgresql-8.0.0beta1\src>nmake /f win32.mak
Microsoft (R) Program Maintenance Utility Version 6.00.8168.0
Copyright (C) Microsoft Corp 1988-1998. All rights...
|
by: Vidyasagara Guntaka |
last post by:
Hi,
I'm not able to compile libpq for Windows environment using the 8.0.0 beta 1 source tree. I got the following errors (The entire compilation output is listed below):
C:\temp\postgresql-8.0.0beta1\src>nmake /f win32.mak
Microsoft (R) Program Maintenance Utility Version 6.00.8168.0
Copyright (C) Microsoft Corp 1988-1998. All rights...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |