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

How to use transaction with PQexecPrepared libpq

I'm new to postgresql and would like to ask how to do a transaction using BEGIN, COMMIT and PQexecPrepared. In my program, I have to update many tables before COMMIT. I do understand that we need to use: 1. PQexec(conn,"BEGIN"); 2. execute some…
muocdich
  • 41
  • 1
  • 8
0
votes
3 answers

GCC C and passing integer to PostgreSQL

I know that there probably was plenty on that but after several days of searching I am unable to find how to do one simple passing of integer and char in one go to PostgreSQL from C under Linux. In PHP it is easy, like 123, and in C using libpq it…
marchefka
0
votes
5 answers

PostgreSQL libpq windows 10 CMake missing PostgreSQL_LIBRARY

I'm rying to setup a CMake project under windows 10 using PostgreSQL. When I try to find_package find_package(PostgreSQL REQUIRED) I get the following error Could NOT find PostgreSQL (missing: PostgreSQL_LIBRARY) (found version "10.4") Call…
tuket
  • 3,232
  • 1
  • 26
  • 41
0
votes
1 answer

Is libpq more like a JDBC driver or JavaSE's java.sql package?

Is it correct that the following two are different concepts: a JDBC driver (e.g. a JDBC driver for PostgreSQL) and JavaSE's java.sql package? Is it correct that the JavaSE's java.sql package is an API built upon a JDBC driver, to become…
user3284469
0
votes
1 answer

How to insert text array in PostgreSQL table in binary format using libpq?

I didn't find any documentation describing how to work with binary arrays in PostgreSQL using libpq. So you have table: CREATE TABLE IF NOT EXISTS test_array ( array_column text[] ) You want to insert array in binary format using PQexecParams How…
toozyfuzzy
  • 1,080
  • 1
  • 9
  • 20
0
votes
1 answer

C: libpq-fe try select bigint (int8)

I'm trying run a simple query on postgres, but I cant get the value of bigint column. Everything I try returns 0 (zero) or the wrong value... When i use strtoll, return 0 (zero) int64_t ret = -1; ret = strtoll(v_c3_01, NULL, 10); The test-code…
0
votes
2 answers

Get (integer[]) array value from the query result of PostgreSQL using libpq library

after executing query I run below functions but don't know how to convert value to c integer array. how to get integer array from pptRawValue where COLUMN_VALUE_IN_BINARY_FORMAT when I looked at memory i can see the value are present in pptRawValue…
MUKHTAR INAMDAR
  • 85
  • 4
  • 17
0
votes
0 answers

how to execute postgresql function with unnest array as parameter using libpqxx c++

I have created a postgresql function, create or replace function check4(interval_ int[],password_ text[]) returns void as $$ begin EXECUTE ' INSERT INTO test(id,password) SELECT unnest($1),unnest($2)' USING $1,$2; …
bhagya10
  • 1
  • 1
0
votes
0 answers

BYTEA to Integer using libpq

I have a table with two columns: 1) id SERIAL PRIMARY KEY 2) BYTEA I am trying to fetch all the rows using PGresult * res = PQexecParams(conn, "select * from table",0,NULL,NULL,NULL,NULL,1); ==> The last argument = 1 specify results to be in…
Saurabh
  • 295
  • 3
  • 12
0
votes
1 answer

Delete the record using libpq PQexecParams() query

I am trying to delete a record using libpq PQexecParams() function. The query is successfully returned but required row is not deleted from the table. Here is the snippet from my code for reference. I have used PQexecParams() for select and insert…
0
votes
0 answers

String formatting settings in PostgreSQL/libpq

I am using libpq for my C/C++ application to interface with PostgreSQL. My queries are parameterised and in text (not binary) format (using PQexecParams), and they return data that might be a text, text[], int4range, or other complex types. …
Bernard
  • 5,209
  • 1
  • 34
  • 64
0
votes
1 answer

Form designer in Delphi can't find DLL

Where to put DLLs so that Delphi could find them at design time? I am editing properties of TDBChart at design time in Delphi. When I attempt to set data source for Series, it complains about absence of libpq.dll which does exist and is in PATH. The…
Paul
  • 25,812
  • 38
  • 124
  • 247
0
votes
1 answer

Libpq speed on windows

I have a problem with libpq on windows. Connecting to a db and running a "select * from some_table;" is very slow. The table has only 1800 rows, 7 columns. No blobs etc. The query is taking around 3500ms, in linux it takes around 800ms. (About…
Rob
  • 2,511
  • 2
  • 20
  • 31
0
votes
1 answer

How I can attach PostgreSQL C library via QBS?

I have a project that should use postgresql c-library (libpq) and project is configured. How I can configure QBS module to import all required headers and libs into project?
Roman Volkov
  • 245
  • 1
  • 4
  • 12
0
votes
1 answer

golang postgres too many connections error

I am new to Golang/Postgres and I am doing some testing and getting an pq: sorry, too many clients already error . My postgres instance is set to a max of 100 connections and I am getting that error in this code for i := 0; i < 10000; i++ { …
Rome Torres
  • 1,061
  • 2
  • 13
  • 27