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

running PostgreSQL client in C from Cygwin

I'm trying to build a very simple PostgreSQL client in C over Cygwin. Here's what I've done so far: I've downloaded the PostgreSQL source code version 9.1.2 (to match the same version that is running on my server) I've configured and compiled the…
Denis
  • 1,031
  • 3
  • 11
  • 22
5
votes
2 answers

Simple Postgresql libpq code too slow?

I was working on postgresql using libpq. The code given below is taking a lot of time (timings given at the end of code). #include "stdafx.h" #include #include #include static void exit_nicely(PGconn *conn) { …
c0da
  • 1,009
  • 3
  • 14
  • 28
4
votes
0 answers

How to upgrade libpq.dll to the latest version on Windows 10 64-bit?

I installed PostgreSQL 13.3 which supports SCRAM authentication. Now, when I try to connect to PostgreSQL, I get an error that SCRAM authentication requires libpq version 10 or above. How do I upgrade libpq.dll to the latest version on Windows 10…
4
votes
2 answers

PostgreSQL C++ libpq encoding UTF-8 problem

I don't have problem inserting UTF-8 (korean character in my case) using direct sql command in PGAdmin or psql console. But when I need to insert values in C++ by using libpq library, I got the encoding error and I couldn't resolve it until now. I…
gameon67
  • 3,981
  • 5
  • 35
  • 61
4
votes
2 answers

Compiling libpq with iOS SDK 4.2

I'm trying to compile again the libpq for arm and i386 with the iOS SDK 4.2. I did last year for SDK3.x without any problems. Now, when I want to create the fat binary file with two files, I'm getting this error: specifed architecture type (arm) for…
mongeta
  • 2,301
  • 2
  • 32
  • 42
4
votes
2 answers

creating jobs and schedules programmatically with pgagent

Is there a way to create and manage jobs/schedules in pgagent programmatically, i.e. WITHOUT using pgAdmin ? I suspect there may be a way of doing this by writing a postgres client using libpq (in case pgagent does not support this behavior out of…
skyeagle
  • 6,925
  • 16
  • 56
  • 71
4
votes
1 answer

libpq how to pass bulk data

I'm trying to pass multiple rows to a test table and I'm having trouble understanding how exactly it's done in libpq. I've found commands for copying data that I believe are needed, but there aren't any examples as to how to use…
Exuro
  • 229
  • 3
  • 15
4
votes
1 answer

Inserting a floating point number in a table using libpq

I am inserting a floating point number in a table using libpq. I am getting this error INSERT failed: ERROR: insufficient data left in message. Here is the corresponding snippet from my code base: printf ("Enter write parameter_value"); scanf("%f",…
4
votes
1 answer

Inserting integer array with postgresql in C (libpq)

I'm trying to post an integer array into my postgresql database. I'm aware that I could format everything as a string and then send that string as one SQL command. However, I believe the PQexecParams function should also bring some help. However,…
Elamre
  • 103
  • 2
  • 9
4
votes
1 answer

pgsql numeric/decimal binary representation & Cocoa

I'm trying to add support for numeric/decimal pgsql (but also SQL99 standard) data type to a cocoa framework. So far i haven't been able to find anything about the internal binary representation libpq is using when presenting its output for queries…
user4096537
4
votes
1 answer

row number 0 is out of range 0..-1 returned when using setSingleRowMode libpq

I was trying to retrieve the row one by one using PQsetSingleRowMode. The result set is ok except the last 3 rows are returned with row number 0 is out of range 0..-1 This is my main function: int main(){ /* The code to create connection to the…
Sophia Ngo
  • 199
  • 1
  • 2
  • 6
4
votes
2 answers

Find out if network connection is lost using libpqxx

I 'm writing a C++ client program quering a postgreSQL database via the internet. I want to handle the event when while waiting for an answer, a network connection problem occurs and so the client can't receive any messages from the database server.…
Angelos Makrygiorgos
  • 1,382
  • 2
  • 8
  • 17
4
votes
4 answers

How to manage endianess of double from network

I have a BIG problem with the answer to this question Swap bits in c++ for a double Yet, this question is more or less what I search for: I receive a double from the network and I want to encoded it properly in my machine. In the case I receive an…
Stephane Rolland
  • 38,876
  • 35
  • 121
  • 169
4
votes
1 answer

Ruby script hangs on bad PG connection call

I have a Ruby script that is connection to a postgres database, runs some queries, and then closes/returns data to the user. The script works fine, but if I give it a bad hostname the entire script just hangs, and I have to ctrl-Z out of it. I know…
Will Bates
  • 81
  • 1
  • 4
4
votes
2 answers

Why is rake aborting because of libpq.5.dylib

I just installed PostgreSQL and the pg gem for running Rails on Heroku. I'm running $ rake -T But it's aborting for reason related to "libpq.5.dylib" rake aborted! dlopen(/Library/Ruby/Gems/1.8/gems/pg-0.13.2/lib/pg_ext.bundle, 9): Library not…
jwilsco
  • 388
  • 2
  • 8
1 2
3
22 23