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
0
votes
0 answers

Using libpqxx and C++ - how to instantiate a connectionObject and an worker in a different class

Here's the example function: #pragma once #include #include #include int main() { std::string connectionString = "host=ec2-54-74-35-87.eu-west-1.compute.amazonaws.com port=5432 dbname=d8iolcesns1bj4…
Octavian Niculescu
  • 1,177
  • 1
  • 3
  • 24
0
votes
0 answers

Libpqxx throws many DLL errors

I tried using https://en.wiki.imlint.org/Pqxx_tutorial to use postgres 14 and cpp. I followed the steps in there and I'm trying to run the code from the website but I'm getting DLLs errors. I've already tried to add them from sites likes…
Alejandro V
  • 39
  • 1
  • 4
0
votes
0 answers

How to pass a param for a binding in PostgreSQL - COPY (... ) TO STDOUT (FORMAT binary)?

I have some simple test table in postgres like below: --DROP TABLE test_point CREATE TABLE test_point ( serie_id INT NOT NULL, version_ts INT NOT NULL, PRIMARY KEY (serie_id, version_ts) ); I try to load a data from it by using COPY…
0
votes
2 answers

PostgreSQL Save and Pick files using Bytea binary data with C libpq

This was the result of my experiments with bytea with postgreSQL and libpq. The result file I am creating with the recieved data is double sized than the original uploaded plus 2 bytes (picture.png). I can not understand exactly how many operations…
Kornelius
  • 33
  • 5
0
votes
1 answer

How to monitor/list outgoing connections to foreign servers in postgres?

I currently use the native foreign data wrapper extension to connect to some other postgres instances (sharding architecture). Now I would like to understand how those underlying outgoing connections are managed by the fdw. I read in the…
biocarl
  • 111
  • 1
  • 5
0
votes
1 answer

Undefined reference when linking libpq in C++ project

I am trying to use libpqxx (and implicitly libpq) in a C++ project. I use vcpkg as a submodule to get my libs by setting CMAKE_TOOLCHAIN_FILE. When I try to build, I get the following errors: /usr/bin/ld:…
codentary
  • 993
  • 1
  • 14
  • 33
0
votes
1 answer

Retrieve a list of the databases from postgres server via libpq

I've tried to find a way to ask the postgres server for the current list of databases (and later list and describe the tables) from a C program using the libpq library. Currently I'm doing a (simplified) popen("psql --command '\\l'") but this is not…
kzangeli
  • 403
  • 2
  • 8
0
votes
1 answer

Can not run libpq examples in Visual Studio 2019

I am new to C++. I downloaded https://ftp.postgresql.org/pub/source/v13.1/postgresql-13.1.tar.gz from https://www.postgresql.org/ftp/source/ and unpacked it. I created a new project in VS Community 2019. Added the example…
Ivan F.
  • 109
  • 1
  • 8
0
votes
1 answer

Using sequelize with Postgresql in Docker: Libpq dependency Exec format error

I'm trying to connect to a PostgreSQL database hosted on Azure from a Dockerized Node app with Sequelize. However, I'm getting an error that the libpq dependency can't be found when run in the container. It works fine on my local machine. (node:40)…
nosvalds
  • 100
  • 1
  • 10
0
votes
1 answer

Error when executing C program using PostGreSQL libpq in Windows 10. (libssl-1_1-x64.dll and non-existent Avast antivirus)

I have a C program (compiled and built in VisualStudio 2019), which I want to connect to a PostGreSQL DB. I included the libpq header files, put the DLLs in the right place, etc. Compilation and build operations finish with no errors. However, when…
0
votes
0 answers

Can't find libpq library for C++ program using libpqxx

I'm not a C++ developer and I don't know very much about compiling projects or makefiles, but I'm trying to compile and run someone else's C++ program. I'm using Ubuntu. Here's the makefile I have so far, based on this: TARGET_EXEC ?=…
Zyxl
  • 93
  • 7
0
votes
1 answer

Unable to load tidycensus and map view packages on Macbook

I installed the packages tidycensus and mapview in RStudio but I get the following error when I try load either one: library(tidycensus) Error: package or namespace load failed for ‘tidycensus’ in dyn.load(file, DLLpath = DLLpath, ...): unable to…
gm007
  • 547
  • 4
  • 11
0
votes
2 answers

libpqxx C Aggregate Extension returns wrong data?

I am learning how to create C aggregate extensions and using libpqxx with C++ on the client side to process the data. My toy aggregate extension has one argument of type bytea, and the state is also of type bytea. The following is the simplest…
0
votes
0 answers

Insert Binary timestamp without timeZone using libpq

How can I please Insert Binary Timestamp in the table car1 using libpq and PQexecParams? The code works but the timestamp in the table is not correct res = PQexec(conn, "CREATE TABLE IF NOT EXISTS car1 (id int, price float8, sale float8, delay…
Derrick
  • 21
  • 3
0
votes
1 answer

Insert Binary Float using PQexecParams

May be I done a mistake, how can i please direct insert binary float in my table. I don't know if i done the things right. The code works but the values are not correct Thank you for reply static void to_nbo(double in, double *out) { uint64_t *i…
Derrick
  • 21
  • 3