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
2
votes
1 answer

PSQL prepared statement query hangs when size of parameters exceeds 393166 characters

I am working on a C++ app and making inserts into a local postgres database using the libpq library. I am running into an issue where if I attempt to query the database with a prepared statement, the query appears to hang if the parameters are too…
Ayman Elmubark
  • 959
  • 1
  • 6
  • 11
2
votes
1 answer

Problem with library libpq in Debian

I'm installing postgresql 8.4 in Debian, put program testlibpq.c from http://www.postgresql.org/docs/9.0/interactive/libpq-example.html to directory which have file libpq-fe.h, but after compilation gcc write me testlibpq.c:(.text+0x4a): undefined…
user710052
  • 41
  • 2
  • 3
2
votes
1 answer

How to handle a numeric data type from PostgreSQL in C?

I try to convert data queried via libpq in binary format into Arrow format in C. For that, I queried the data type Oids for the corresponding columns via PQftype() and match them with Arrow datatypes. But I am not sure how to handle numerics. The…
Hyrikan
  • 59
  • 7
2
votes
1 answer

Cast to a type by its OID?

I would like to cast a value to a type using not the type name, but the OID of the type. Is this possible? So instead of: SELECT '{{a}}'::char[] do SELECT '{{a}}'::1002 (although the above results in a syntax error) Context: I'm writing a library…
Michal Charemza
  • 25,940
  • 14
  • 98
  • 165
2
votes
2 answers

How to prevent Columns from being Decimals in DataFrames when retrieved from Postgres

I have a DataFrame df which I retrieved from a Postgres database as follows using DataFrames, LibPQ con = LibPQ.Connection(con_string) result = execute(con, "SELECT * FROM [table]") df = DataFrame(result) close(con) Sorry, I cannot make this…
Georgery
  • 7,643
  • 1
  • 19
  • 52
2
votes
0 answers

postgres.app: How Do I Install libpq-dev on the Mac?

I'm running the latest version of postgres using the postgres app. [mydir] (master) which psql /Applications/Postgres.app/Contents/Versions/latest/bin/psql I've been getting errors when I try to install the RubyGem pg. ERROR: Error installing pg: …
2
votes
0 answers

PostgreSQL ODBC Driver hangs during SQLExecDirect

This happens just in prod environment and I could not reproduce same behaviour in a sandbox. #0 0x00007f07854d8cb9 in __GI___poll (fds=0x7f076d8f1e88, nfds=1, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29 #1 0x00007f077c2ad990 in ?? () from…
danilabagroff
  • 602
  • 1
  • 7
  • 23
2
votes
1 answer

Light Alpline docker container with psycopg2

I have a few services that run python 3.7 with flask and only require a few extra libraries. One of them is psycopg2 to be able to connect to postgres. In itself, installing psycopg2 in alpine is not a very difficult task but I had some problems…
Samuel O.D.
  • 346
  • 2
  • 13
2
votes
3 answers

copy libpq.5.dylib to /usr/lib/libpq.5.dylib

I can't load packages in R because the file libpq.5.dylib is not in /usr/lib/libpq.5.dylib. It is in /usr/local/Cellar/libpq/13.0/lib/libpq.5.dylib I tried this line: sudo ln -s /usr/local/Cellar/libpq/13.0/lib/libpq.5.dylib /usr/lib/libpq.5.dylib…
gm007
  • 547
  • 4
  • 11
2
votes
2 answers

How handle UTF-8 encoding error in libpq?

I have created this function to insert data into database: void add_data_to_db(){ const char *data[2][2] = {"2","e"}; re = PQexecParams(connection, "INSERT INTO test_table "\ "VALUES…
Amir reza Riahi
  • 1,540
  • 2
  • 8
  • 34
2
votes
1 answer

Why do I get compilation errors when trying to connect to postgresql with c?

I tried to create a simple c programm which should connect to my postgres db, but I am not able to get aware of the following compilation errors... I am using Ubuntu (but also tried to compile on Fedora already - with the same errors...) uname…
roegi
  • 183
  • 1
  • 16
2
votes
2 answers

Why are there 2 libpq folders in PostgreSQL

In the PostgreSQL source code there are 2 libpq folders : src/interfaces/libpq src/backend/libpq What is the difference between them? As from what I have seen only the one present in interfaces folder is compiled and referred.
2
votes
1 answer

Bulk insert to postgresql with prepared statement(s)

I'm using libpq (but I am potentially be ready to switch to other library) I have a bunch of similar INSERT queries I want to make, they are different only in values between them. I'd like to use prepared statements to avoid issues with escaping…
RiaD
  • 46,822
  • 11
  • 79
  • 123
2
votes
0 answers

Segmentation fault when call PQfinish inside singletone pattern

I'm create singletone class, and want to add inside PGconn object. This class, in the past, will provide connections to DB. // postgresql #include //============================================================================== class…
2
votes
1 answer

Issue with libpq.so.5 and PQencryptPasswordConn version RHPG_10 on Fedora30

I am trying to run my python script but I am getting below error. I tried to install and uninstall psycopg2 in different ways but is not working. My postgres version is 9.6 and my psycopg2 version is 2.8.2. Anyone had the same issue? Thanks in…
Joan Triay
  • 1,518
  • 6
  • 20
  • 35