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
8
votes
3 answers

Can`t install libpq-dev

I am trying to install libpq-dev as postgres requires it, but I only get an error. pip install libpq-dev==9.4.3 Could not find a version that satisfies the requirement libpq-dev==9.4.3 (from versions: ) No matching distribution found for…
seoful
  • 91
  • 1
  • 1
  • 2
7
votes
1 answer

Postgresql PQgetvalue: array return

I've a table created like: CREATE TABLE tbl_test ( id bigserial PRIMARY KEY, interest int ARRAY[2] ); I got PGresult* res using PQexec(conn, "SELECT * FROM tbl_test"); Now, how can I get int[] from PQgetvalue(res, 0, 1). I…
Mayank
  • 5,454
  • 9
  • 37
  • 60
7
votes
1 answer

How can I make a psycopg2 connection using environment variables?

I'm confused by the psycopg2 documentation where it says: Also note that the same parameters can be passed to the client library using environment variables. I would expect that if I have environment variables exported such that I can connect…
kojiro
  • 74,557
  • 19
  • 143
  • 201
7
votes
1 answer

postgresql "keepalives" parameter

According to PostgresSQL docs there is parameter keepalives and further parameters keepalives_idle, keepalives_interval and keepalives_count which are relevant only if keepalives=1. But it is not clear to me what does it mean if the parameter…
zlatko
  • 596
  • 1
  • 6
  • 23
7
votes
1 answer

Can't create dbConnect to Postgres with SSL

I'm running a Postgres-9.4 server that I would like to require SSL for. When I connect to the Postgres server from my laptop with either pgadmin or windows odbc connection, it works with SSL. However when I try to connect with R using SSL it…
Dean MacGregor
  • 11,847
  • 9
  • 34
  • 72
7
votes
2 answers

Why does `libpq` use polling rather than notification for data fetch?

I am reading libpq reference. It has both of sync and async methods. Bu I discovered something strange. When I see PQsendQuery function, it seems to send a query and return immediately. And I expected a callback function to get notified, but there…
eonil
  • 83,476
  • 81
  • 317
  • 516
7
votes
3 answers

Ruby on Rails / PostgreSQL - Library not loaded error when starting server

Heyo. I apologize in advance if this question has been answered in another thread. I've searched through the site but I didn't find an answer. However, the closest related issue was Ruby on Rails / PostgreSQL - Library not Loaded error when starting…
stewartm
  • 179
  • 1
  • 2
  • 10
7
votes
1 answer

g++ throwing file not recognized: File format not recognized error

getting following error with the command g++ -o test -L . -l pq libpq.so: file not recognized: File format not recognized #file libpq.so libpq.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), not stripped gcc version 4.1.2 20070115…
user1991251
  • 81
  • 1
  • 1
  • 3
6
votes
2 answers

Mysterious error: invalid byte sequence for encoding "UTF8"

I'm stuck trying to find a cause for invalid byte sequence for encoding "UTF8". It is an C program using libpq. I'm using PQexecParams to execute the SQL query. The offending byte sequence is completely random, sometimes the command even runs ok.…
jira
  • 3,890
  • 3
  • 22
  • 32
6
votes
1 answer

How to install libpq-dev package for windows

I know how to install libpq-dev for ubuntu, but I was looking through past questions and I was not able to find out how to install the package for windows. Is there a place to download that package or a place to download an installer for it?
user1842633
  • 305
  • 1
  • 4
  • 15
6
votes
2 answers

ODBC v Libpq: C library for PostgreSQL

I am going to be using a C library to connect and use a PostgreSQL database, I was wondering what are the pros and cons to ODBC and Libpq. From what I can tell, libpq seems to be faster but I was not able to get any clear answers or benchmarks.…
RMT
  • 7,040
  • 4
  • 25
  • 37
5
votes
2 answers

Insert Binary Large Object (BLOB) in PostgreSQL using libpq from remote machine

Can you give an example of inserting binary data in PostgreSQL database from remote machine using libpq. My second question is: Is there any other API more efficient than libpq with C++. Thanks
Mezo
  • 145
  • 1
  • 7
5
votes
2 answers

PHP & PostgreSQL – sslmode value "require" invalid when SSL support is not compiled

I'm trying to connect to Heroku Postgres which only support SSL connections. SSL connection works fine from other tools (Postico) and programming environments (Node.js), but when connecting from PHP I always get this error: sslmode value "require"…
Vilis
  • 1,062
  • 2
  • 12
  • 21
5
votes
1 answer

libpq, insert with parameters

I am wondering if I can make parameterized queries directly from C/C++ with libpq instead of using strings and if do how should this code look's like? string tblins = ""; tblins = "INSERT INTO " + commtable + " " "(vdoc, bdoc, mytime, txml)…
Wine Too
  • 4,515
  • 22
  • 83
  • 137
5
votes
1 answer

libpq - PQsendQuery wait for complete result

I'm having problem with libpq's PQexec function hanging on intermittent connections. After looking around the mailing list, the solution is to use the asynchronous functions PQsendQuery/PQgetResult and implement your own timeout. Now the issue I'm…
Ilia Choly
  • 18,070
  • 14
  • 92
  • 160
1
2
3
22 23