Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iJIEG-0003jK-Sc for pgsql-bugs@arkaria.postgresql.org; Sat, 12 Oct 2019 14:18:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iJIDH-0002sc-NL for pgsql-bugs@arkaria.postgresql.org; Sat, 12 Oct 2019 14:17:43 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iJIDH-0002sJ-Br for pgsql-bugs@lists.postgresql.org; Sat, 12 Oct 2019 14:17:43 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iJIDE-0008Ur-W7 for pgsql-bugs@lists.postgresql.org; Sat, 12 Oct 2019 14:17:42 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x9CEHbqi031797; Sat, 12 Oct 2019 10:17:37 -0400 From: Tom Lane To: Bart Smink cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16051: PQgetvalue(res,0,0) is null, PQgetlength(res,0,0) is 10 In-reply-to: References: <16051-cf9069d07dd1df16@postgresql.org> <4785.1570851049@sss.pgh.pa.us> Comments: In-reply-to Bart Smink message dated "Sat, 12 Oct 2019 10:42:52 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <31795.1570889857.1@sss.pgh.pa.us> Date: Sat, 12 Oct 2019 10:17:37 -0400 Message-ID: <31796.1570889857@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Bart Smink 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