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
99
votes
16 answers

Rails 3 - can't install pg gem

When I try to run bundle (bundle install), I all the time get Installing pg (0.13.2) with native extensions Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /Users/ryan/.rvm/rubies/ruby-1.9.2-p290/bin/ruby…
user984621
  • 46,344
  • 73
  • 224
  • 412
66
votes
20 answers

How can I solve Postgresql SCRAM authentication problem?

I am getting an error after moving the project to production. The error is as follows while running with production server pg_connect(): Unable to connect to PostgreSQL server: SCRAM authentication requires libpq version 10 or above. Here is my…
Alimin
  • 2,287
  • 6
  • 19
  • 31
25
votes
2 answers

Library not loaded: libpq.5.dylib

I have app that is running Ruby 1.9.2, Rails 3, and postgreSQL 8.3. It was originally setup and working with postgreSQL 9.1, but I uninstalled 9.1 and installed and changed to 8.3 insure compatibility on a Heroku shared database setup. It was…
Mike McCoy
  • 797
  • 2
  • 10
  • 19
21
votes
1 answer

gyp Failing when Installing pg-native

I'm trying to install the pg-native package: sudo npm install pg-native but the following error is generated: > libpq@1.7.0 install /Workspace/auth/node_modules/libpq > node-gyp rebuild /bin/sh: pg_config: command not found gyp: Call to 'pg_config…
James Taylor
  • 6,158
  • 8
  • 48
  • 74
19
votes
8 answers

How to fix diesel_cli link libpq.lib error with Postgres tools installed in Docker?

I'm trying (for hours now) to install the cargo crate diesel_cli for postgres. However, every time I run the recommended cargo command: cargo install diesel_cli --no-default-features --features postgres I wait a few minutes just to see the same…
CoderLee
  • 3,079
  • 3
  • 25
  • 57
18
votes
2 answers

Error loading psycopg2 module: Library not loaded: libpq.5.dylib

I am trying to run a Django project with Postgres database. I use Postgres 13.4 installed via postgressapp (UNIVERSAL with all currently supported versions) and python 3.9 (in venv). I work on Mac with Apple M1 chip, macOS Big Sur. I faced the…
kokserek
  • 530
  • 8
  • 21
16
votes
4 answers

FindPostgreSQL.cmake won't work on ubuntu

Ubuntu 12.04 CMake 2.8.9 Postgresql 9.2.2 I'm trying to get the FindPostgreSQL module to find /usr/include/postgresql/libpq-fe.h. Here's what I have in my CMakeLists.txt: find_package(PostgreSQL REQUIRED) This is the error I get: CMake Error…
Ilia Choly
  • 18,070
  • 14
  • 92
  • 160
11
votes
1 answer

create function unterminated dollar-quoted string

I'm trying to create this function with Goose using a postgres (pq lib) database. My code is as follows: CREATE OR REPLACE FUNCTION add_userlocation(user_id INT, location_id INT) RETURNS VOID AS $BODY$ BEGIN LOOP UPDATE…
puredevotion
  • 1,135
  • 1
  • 11
  • 27
10
votes
3 answers

PostgreSQL's libpq: Encoding for binary transport of ARRAY[]-data?

after hours of documentations/boards/mailinglists and no progress I may ask you: How do I 'encode' my data to use it for binary transport using libpq's PQexecParams(.) ? Simple variables are just in big endian order: PGconn *conn; PGresult…
Tebas
  • 547
  • 1
  • 6
  • 13
10
votes
4 answers

How to connect to postgresql, without specifying plain-text password, with libpq's pgpass?

Postgres' C library libpq documentation talks about a more secure way to connect to a DB without specifying password in source code. I was not able to find any examples of how to do it. How to make my Postgre Server use this file? Please help.
ovod
  • 1,118
  • 4
  • 18
  • 33
10
votes
2 answers

Type conversion. What do I do with a PostgreSQL OID value in libpq in C?

I'm working with the PostgreSQL C API, libpq. I need to be able to convert the values in a PGresult* into their equivalent data types in Ruby. I'm currently just selecting all the data and using PQgetvalue(), which gives me a char* that I can…
d11wtq
  • 34,788
  • 19
  • 120
  • 195
9
votes
1 answer

Is it required to execute 'ROLLBACK' upon error?

I'm a newbie with PostgreSQL/libpq. So please help me clarify my confusion: Assuming I start by executing a 'START TRANSACTION' and do proper error checking (PQresultStatus(res) != [proper_success_value]), am I required to execute a 'ROLLBACK' if…
AcarX
  • 289
  • 2
  • 10
9
votes
2 answers

PostgreSQL: cancel query from C/C++ program

I'm using PostgreSQL 8.3, and writing a program in C++ that uses the libpq API. I execute commands asynchronously with the PQsendQuery() function. I'm trying to implement a timeout processing feature. I implemented it by calling PQcancel() when the…
petersohn
  • 11,292
  • 13
  • 61
  • 98
9
votes
3 answers

PDO vs pg_* functions

They both have prepared statements. pg_* is a wrapper to libpq. Right? I like the PDO in PHP, but I'm not going to change the database in the future. Which library should I use? Any benchmark? PHP version: 5.4
MorrisonHotel
  • 101
  • 1
  • 3
8
votes
5 answers

cannot link libpq on Mac M1

I've been trying to run the Rust Diesel crate on my Macbook M1 and it doesn't work. The final part of the compilation gets broken by the following error: = note: ld: warning: ignoring file /usr/local/Cellar/libpq/14.1/lib/libpq.dylib, building for…
max89
  • 443
  • 5
  • 18
1
2 3
22 23