244 questions
1 vote
1 answer
44 views
Get data inside an arbitrary number of date ranges
My problem is that this doesn't scale very well with more and more time ranges: WITH ranges AS ( SELECT tsrange($1::timestamptz, $2::timestamptz, '[]') AS r UNION ALL SELECT tsrange($3::...
3 votes
2 answers
131 views
How to execute non-transactional statements like CREATE DATABASE in libpqxx?
I’m using libpqxx to run SQL scripts. For most DDL and DML this works fine, but I’ve run into a problem with statements that cannot be executed inside a transaction block, e.g. CREATE DATABASE mydb; ...
3 votes
2 answers
167 views
Force adl to not use function from specific namespace
I need to support a new type (OuterType) for libpqxx. This type is located in namespace partner, also namespace contains free function to_string(const OuterType&), which returns wrapper around ...
0 votes
1 answer
174 views
Undefined symbols (link error) when using libpqxx
I can't seem to link libpqxx. The program: #include <pqxx/pqxx> int main() pqxx::connection connection(""); return 0; } The command to compile: g++ -std=c++23 -arch arm64 x....
1 vote
1 answer
172 views
Can't connect to PostgreSQL in pqxx C++
when trying to connect to the database the following error appears error text terminate called after throwing an instance of 'pqxx::broken_connection' what(): connection to server on socket "/...
0 votes
0 answers
153 views
error while loading shared libraries: libpqxx-6.2.so: cannot open shared object file: No such file or directory
After building the code when run the executable I get error ./test_pq: error while loading shared libraries: libpqxx-6.2.so: cannot open shared object file: No such file or directory Example of my ...
-2 votes
1 answer
321 views
Are there any disadvantages to using libpqxx nontransaction when transaction has only one statement
In my app I am reading and writing to the database using pqxx::work, which resolves to using work = transaction<>. Taking the read as a case in point, it is a single, albeit relatively complex, ...
0 votes
0 answers
130 views
Linkage error of libpqxx (postgresql) on Windows
I added libpqxx (pqxx) via vcpkg to CMake project, however it's failed while building. Here is CMake code: find_package(libpqxx CONFIG REQUIRED) target_link_libraries(PqDataBase PRIVATE libpqxx::pqxx)...
1 vote
0 answers
100 views
Getting false positive trigger signal from libpqxx await_notification()
The code below uses libpqxx C++ library to listen to two trigger signals coming from a TimescaleDB database. There are two infinite loops to wait until a trigger occurs. while (true){ conn....
0 votes
1 answer
109 views
subscribing to two trigger channels using libpqxx
I am trying to subscribe to two different notifications using libpqxx. I found this unit test which I modified to serve my objective. class TestListener final : public pqxx::notification_receiver { ...
0 votes
0 answers
74 views
have libpqxx subscribe to a channel
I am trying to listen to an event in a PostgreSQL database when a table is updated. The trigger is created in the database and I would like to have libpqxx listen to the trigger signal. I have tried ...
0 votes
0 answers
146 views
Linker errors while building c++ app which use pqxx library
i encounter problems while building an c++ app with pqxx library. I installed this library with c++ package manager called vcpkg. Other libraries like boost or curl work but pqxx not. I there some ...
0 votes
1 answer
379 views
This libpqxx version needs at least C++17 (MacOS)
this error appeared when compiling the libpqxx library ./configure checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a race-...
0 votes
0 answers
801 views
How to build libpqxx libraries in C++ with Visual Studio 2022
I am trying to develop a database app using PostgreSQL with VS2022 in C++. I have successfully installed Postgres 16.1-1 software and a data directory in my Documents directory. I unzipped libpqxx-7....
0 votes
2 answers
115 views
Get index and value of variadic template at compile time
I have a function that looks like this template <typename... Rets, typename... Args> std::tuple<Rets...> call_nn(std::string_view query, Args... args) { pqxx::work w(con_); pqxx::row ...