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
2 answers

row number 0 is out of range 0..-1 LIBPQ

query = "select * results where id = '"; query.append(ID); query.append("'"); res = PQexec(conn, query.c_str()); After executing this statement, i get the following error. row number 0 is out of range 0..-1 terminate called after throwing an…
Irfan
  • 19
  • 4
0
votes
1 answer

Streaming libpq results from PQexec

In attempting to download a large batch of data from Postgres 9.3 in C via libpq's PQexec, I'm wondering if there's a way to stream the result set from the server. From watching top, I can see my memory utilization increasing by roughly the expected…
Justin
  • 500
  • 8
  • 18
0
votes
1 answer

Libpq5.6.dylib not found, how do I install 5.7?

I run rake db:create and get a libpq not found. I have 5 and 5.7 .. how do I upgrade postgres to use 5.7? rake db:create rake aborted! LoadError:…
quantumpotato
  • 9,637
  • 14
  • 70
  • 146
0
votes
1 answer

postgres/libpqxx: Refuses authentication via password

I'm using two tools here in university, wich both work with the same postgres database. The one written in Java uses the jdbc-driver and that works just fine. The second one written in C++ has some difficulties. It gives me following error Ident…
Daniello
  • 175
  • 14
0
votes
1 answer

Which OIDs to specify to functions like PQexecParams for array types?

E.g., I want to pass a value like the following as a parameter to it: {{1, 2, 3}, NULL, {4, 5, 6}} Which OID should I specify for it and where can I find any related specs? I tried using 2277 (anyarray) and 20 (int8), but it fails.
Nikita Volkov
  • 42,792
  • 11
  • 94
  • 169
0
votes
1 answer

Query to PostgreSQL returns a result with 1 column and 0 rows?

I am accessing the PostgreSQL server with libpq. My query looks like this ('Africa' is any string, column_2 and column_3 are both valid names and both queries return fine when executed from psql prompt): SELECT column_2 FROM mytable WHERE…
user10607
  • 3,011
  • 4
  • 24
  • 31
0
votes
1 answer

Inserting a point via libpq with pgexecparams

I'm trying to insert a point into a Postgresql table with c++. This is what I have so far: const char * paramValues[1]; paramValues[0] = "{100,200}"; res = PQexecParams(conn, "insert into test (pt) values ($1::point)", 1, NULL, paramValues, NULL,…
user3791372
  • 4,445
  • 6
  • 44
  • 78
0
votes
1 answer

postgres libpq: synchronous COPY mysteriously cancelled "due to user request"

My application is using libpq to write data to Postgres using the COPY API. After over 900000 successful COPY+commit (each containing a single row, don't ask) actions, one errored out with the following: ERROR: canceling statement due to user…
Raven
  • 1,264
  • 1
  • 12
  • 22
0
votes
1 answer

Passing parameter to HP Vertica via libpq returns "Syntax error"

I'm trying to query data from HP Vertica 6 using libpq: SELECT * FROM columns WHERE table_name=? and getting the error back: ERROR: Syntax error at or near "EOL" LINE 1: ...FROM columns WHERE table_schema=? …
Terry
  • 310
  • 3
  • 9
0
votes
1 answer

PostgreSQL C++ Api getting error LNK1107: invalid or corrupt file: cannot read at 0x2E8

I try libpqxx and pg_bulkload for C++ data bulk loader from my Simple C# App. Because this two libs on my PC not finally supported. I now , new create simple DLL project,with native PostgreSQL libpq methods. CPPApp.h #pragma once #ifdef…
Elyor
  • 900
  • 1
  • 12
  • 26
0
votes
2 answers

Force libpq to compile with 10.5

I need to compile libpq with 10.5 for using later in the simulator. I can use the libpq in the device without problems. I'm forcing with this: make clean && ./configure CFLAGS="-arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk" && make -C…
mongeta
  • 2,301
  • 2
  • 32
  • 42
0
votes
0 answers

SQLError() not returns SQL_NO_DATA_FOUND

SQLError() is not returning SQL_NO_DATA_FOUND after driver upgrade from 7 to 9. my code looks like RETCODE rc = SQL_SUCCESS; while ( rc != SQL_NO_DATA_FOUND) { rc = SQLError(henv, hdbc, hstmt, sqlstate, &nativeerr, errmsg, …
user1345697
  • 405
  • 2
  • 5
  • 15
0
votes
1 answer

PostgreSQL and Libpq - Create trigger that prints a line when requirement is not met

I really need help on this one, it's for my university project and I'm stuck. The big idea is to create a trigger on a table that if the value requirement is not met it prints a message to the user and doesn't allow the insert statement to…
Asunez
  • 2,327
  • 1
  • 23
  • 46
0
votes
1 answer

Postgresql and C data types

Is there a mapping between Postgresql data types to C data types Similar to this question PostgreSQL and C# Datatypes
Andy Stow Away
  • 649
  • 1
  • 8
  • 17
0
votes
1 answer

Julia: Ptr{Void} finalizer error

I'm studying Julia and I'm trying to write a libpq (the PostgreSQL C library) wrapper. The C PQconnectdb function starts a PostgreSQL connection, and returns a pointer to the connection struct. The connection struct is not exposed by libpq, since it…
mdesantis
  • 8,257
  • 4
  • 31
  • 63