libpq

PostgreSQL consuming large amount of memory for persistent connection

I have a C++ application which is making use of PostgreSQL 8.3 on Windows. We use the libpq interface. We have a multi-threaded app where each thread opens a connection and keeps using without PQFinish it. We notice that for each query (especially the SELECT statements) postgres.exe memory consumption would go up. It goes up as high as...

libpq send integer as binary

I have a libpq program that is routinely inserting numbers into a database. These numbers, which I'm expecting to grow quite large, are stored int the uint64_t type. I'm wanting to send the integer to libpq as binary, but Postgres won't be able to tell its unsigned. Is there a way to specify an unsigned integer in Postgres or libpq? ...

PostgreSQL libpq "Integer out of range" error when sending integer as binary

I'm attempting to insert some integers into a Postgres table with the following somewhat simple code. #include <libpq-fe.h> #include <stdio.h> #include <stdint.h> int main() { int64_t i = 0; PGconn * connection = PQconnectdb( "dbname='babyfood'" ); if( !connection || PQstatus( connection ) != CONNECTION_OK ) return 1; print...

Is there a way to list PostgreSQL servers?

Hi, Currently I am writing client to PostgreSQL servers. I want to list the details (ip address and port number) of the servers that is running PostgreSQL servers in the local network. Is there some methods in libpq or libpqxx ? Regards Devara Gudda ...

Connect iPhone App to PostgreSQL Using Libpq

I need to create an application for the iPhone that will connect to a PostgreSQL 8.4 database using libpq. The problem is I can't get a simple iPhone that links to libpq to compile. I am however able to get the equivalent application that is a regular Mac desktop app to compile and connect to PostgreSQL without any issues. I'm on Xcode ...

Randomly disappearing struct

Hi, I've created a Objective-C class to interface with PostgreSQL using libpq. It mostly works but I have one small problem - the connection seems to disappear randomly. This class is set to open a connection when a window is opened and close that connection before the window closes. On the init code of the window I open the connection...

PostgreSQL notice processing

Hi, I'm working on a C application that is suppose to talk to PostgreSQL. Right now I need to handle notices and warnings sent by the server but I'm at a loss on how to make it work. The (very unclear) documentation says we should use PQsetNoticeReceiver to set a method as the receiver of notifications, as the default receiver just for...

Force libpq to compile with 10.5

Hello, I need to compile libpq with 10.5 for using later in the simulator. I can use the libpq in the device without problems. I'm forcing with this: make clean && ./configure CFLAGS="-arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk" && make -C src/interfaces/libpq but I'm getting the error: ld: library not found for - This ...

How to convert a PGresult to custom data type with libpq (PostgreSQL)

Hi everyone! I'm using the libpq library in C to accessing my PostgreSQL database. So, when I do res = PQexec(conn, "SELECT point FROM test_point3d"); I don't know how to convert the PGresult I got to my custom data type. I know I can use the PQgetValue function, but again I don't know how to convert the returning string to my custom ...

Link libpq.a(Postgres lib) with Xcode project, dependency errors

Hi! I am trying to link libpq.a to a c++ library being build on Xcode, to use Postgres functions's so I can connect and retrieve data. My problem is that when I build the project, it complains about references from the libpq.a, like in the image below: few minutes ago, it was much more errors... it was complaning about openssl lib ...

PostgreSQL's libpq: Encoding for binary transport of ARRAY[]-data ?

Hello, after hours of documentations/boards/mailinglists and no progress I may ask you: How do I 'encode' my data to use it for binary transport using libpq's PQexecParams(.) ? Simple variables are just in big endian order: PGconn *conn; PGresult *res; char *paramValues[1]; int paramLengths[1]; int paramFormats[1]; conn = PQconnectdb...