Questions tagged [libpq]

libpq is the C application programmer's interface to PostgreSQL. libpq is a set of library functions that allow client programs to pass queries to the PostgreSQL backend server and to receive the results of these queries.

libpq is also the underlying engine for several other PostgreSQL application interfaces, including those written for C++, Perl, Python, Tcl and ECPG. So some aspects of libpq's behavior will be important to you if you use one of those packages.

Client programs that use libpq must include the header file libpq-fe.h and must link with the libpq library.

345 questions
3
votes
0 answers

rust-lld: error: unable to find library -llibpq

Useful info I am building a webapp and using as back-end rocket.rs, with diesel.rs to connect to the Postgres database. I wanto to dockerize this webapp: I'm on Windows 11, and I want to cross-compile for Linux alpine, so I can just add the…
CuriousCI
  • 138
  • 1
  • 11
3
votes
1 answer

/usr/bin/ld: cannot find -lpq Issue

My application needs libpq, paho-mqtt libraries and mqtt broker. I have installed and build all of them in a separate folder with my application.While I was trying to build my application using "make" command, I faced with /usr/bin/ld: cannot find…
Aysnr
  • 31
  • 2
3
votes
2 answers

Where is query pipelining in libpq?

I'm developing a high load server application using C++ and libpq (libpqxx is very unstable). I use async queries in threads to improve performance. But I've discovered that, for example, PQsendQuery("SELECT 1;SELECT 1;") works faster then executing…
DAnV
  • 43
  • 5
3
votes
1 answer

How Do You Parse an Array Column in Postgresql Using libpq on Linux

For basic data types I have no problems parsing data using a format like: if (FALSE == PQgetisnull(res, rowNumber, columnIndex)) { retVal.m_assignedSocket = atol(PQgetvalue(res, rowNumber, columnIndex)); } else { …
mojosound
  • 71
  • 6
3
votes
1 answer

How to insert multiple rows into postgres SQL in a go

Is it possible to insert multiple rows into Postgres database at once? Could someone please suggest if there is a way to insert a slice of slices into database. I have created a slice for each row and created a another slice(multiple rows) by…
pretty08
  • 137
  • 3
  • 11
3
votes
1 answer

Missing libpq header files on CentOS when attempting to install psycopg2 module

I have been searching the web hours on end for several days and I am unable to install psycopg2 library on my Linux machine (CentOS - 2.6.32-431.3.1.el6.x86_64 GNU/Linux). I know that the problem is that I am missing the libpq header files since I…
Andrew Goss
  • 45
  • 1
  • 6
3
votes
2 answers

How to download, compile & install ONLY the libpq source on a server that DOES NOT have PostgreSQL installed

How can I download, compile, make & install ONLY the libpq source on a server (Ubuntu) that DOES NOT have PostgreSQL installed? I have found the libpq source here. However it does NOT seem to be separable from the entire PostgreSQL. Thanks in…
3
votes
1 answer

libpq call gives "UTF8": 0xe6 0x62 0x40

I am a former Digital Equipment Co engineer (worked with Rdb/RTR/VMS on lots of very big systems and have 10 years of distributed systems processing experience in C years ... but quite a long time ago). I am looking for advice on what this error…
3
votes
3 answers

libpq: How to get the error code after a failed PGconn connection

Given the following code. PGconn* const conn=PQconnectdbParams(keywords, values, false); if(! conn || PQstatus(conn)!=CONNECTION_OK){ /* error code? */ } In case of a failed connection is there a way to get the error code to be able to distinguish…
helloworld
  • 71
  • 1
  • 7
3
votes
1 answer

How to get the double value using libpq?

The examples in the libpq documentation show how to get the the integer value by converting it to the host-endian representation. I am curious what must be done to get the double precision value using libpq (without libpqtyppes)? I have tried…
Kimi
  • 13,621
  • 9
  • 55
  • 84
3
votes
1 answer

Not retrieving NOTIFY with libpq in a C++ program

I'm enhancing a ROS (robot operating system) stack sql_database to be able to handle postgresqls LISTEN and NOTIFY commands. As mentioned, I'm using libpq version 9.1.10-0 on Ubuntu12.04 within a C++ program. But for some reasons I'm not able to…
MatthiasM
  • 61
  • 6
3
votes
3 answers

PQprepare and PQexecPrepared Usage

Hoping someone can help me with the usage of PQprepare and PQexecPrepared. I'm sure I must have something wrong but nothing I try seems to work. I'm trying to insert into a table using a prepared query but I keep getting this error ERROR: invalid…
Mark Davidson
  • 5,503
  • 5
  • 35
  • 54
3
votes
2 answers

Libpq using large amount of memory for simple example

Why does the following code use 1.2GB of memory to execute? I was expecting memory usage to be relatively flat regardless of the number passed to generate_series, instead it is steadily increasing. Please - tell me I'm doing something wrong! if…
Greg Lowe
  • 15,430
  • 2
  • 30
  • 33
3
votes
1 answer

Libpqxx complaining about missing references

So I have the following problem: g++ -std=c++0x -O3 -I/usr/include/scip main.cpp locations/locationreader.cpp locations/locationassigner.cpp scheduler.o optimizer.o dbmanager.o scheduleData.o exam.o -o main -L/usr/lib -lscip -lreadline -lgmp -lz…
csteifel
  • 2,854
  • 6
  • 35
  • 61
3
votes
2 answers

A good strategy for writing a database abstraction layer in C

I need to write a database abstraction layer in C for the database access API of PostgreSQL (libpq) and possibly some other relational database management system. I am considering writing my own abstraction of the existing functions in pqsql and…
user1254893
  • 527
  • 3
  • 13