pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Bart Smink <bartsmink@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16051: PQgetvalue(res,0,0) is null, PQgetlength(res,0,0) is 10
Date: Sat, 12 Oct 2019 10:17:37 -0400
Message-ID: <31796.1570889857@sss.pgh.pa.us> (raw)
In-Reply-To: <CAN7LKwP1b_FmKv_KzEGN3LSat2PwqTvc1+=7sRRt1=qkq_=aSQ@mail.gmail.com>
References: <16051-cf9069d07dd1df16@postgresql.org>
	<4785.1570851049@sss.pgh.pa.us>
	<CAN7LKwP1b_FmKv_KzEGN3LSat2PwqTvc1+=7sRRt1=qkq_=aSQ@mail.gmail.com>

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





view thread (5+ messages)

Message-ID: <31796.1570889857@sss.pgh.pa.us>
Permalink:  ../31796.1570889857@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/31796.1570889857@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, bartsmink@gmail.com
  Subject: Re: BUG #16051: PQgetvalue(res,0,0) is null, PQgetlength(res,0,0) is 10
  In-Reply-To: <31796.1570889857@sss.pgh.pa.us>
  References: <16051-cf9069d07dd1df16@postgresql.org> <4785.1570851049@sss.pgh.pa.us> <CAN7LKwP1b_FmKv_KzEGN3LSat2PwqTvc1+=7sRRt1=qkq_=aSQ@mail.gmail.com> <31796.1570889857@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox