Re: BUG #16051: PQgetvalue(res,0,0) is null, PQgetlength(res,0,0) is 10

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #16051: PQgetvalue(res,0,0) is null, PQgetlength(res,0,0) is 10
Дата
Msg-id 31796.1570889857@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: BUG #16051: PQgetvalue(res,0,0) is null, PQgetlength(res,0,0) is 10  (Bart Smink <bartsmink@gmail.com>)
Список pgsql-bugs
Bart Smink <bartsmink@gmail.com> writes:
> Thanks for taking a look at my code. The difference is because this table
> will be created once by a setup script that connects without the
> search_path option selecting a scheme  in connect, whereas the program that
> will run on this table connects with a search_path option. Changing the
> command to

> res = PQexecParams(conn,
>             "SELECT * FROM \"Schema1\".testdata;",
>             0,
>             NULL,
>             NULL,
>             NULL,
>             NULL,
>             1
>         );

> makes no difference, the test still fails.

[ looks closer... ]  Oh!  You are asking for binary result format
(resultFormat = 1 in the call), so what you get back is not a
pointer to the string "1234", it's a pointer to whatever the
defined binary format for a numeric is.  That likely begins with
a zero byte, causing your program to think it's an empty string.

            regards, tom lane



В списке pgsql-bugs по дате отправления:

Предыдущее
От: Andrew Gierth
Дата:
Сообщение: Re: BUG #16051: PQgetvalue(res,0,0) is null, PQgetlength(res,0,0) is 10
Следующее
От: PG Bug reporting form
Дата:
Сообщение: BUG #16052: pg_dump --no-comments not working