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 1h1Xfc-0006sh-Li for pgsql-general@arkaria.postgresql.org; Wed, 06 Mar 2019 14:37:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h1Xfa-0007SK-Lq for pgsql-general@arkaria.postgresql.org; Wed, 06 Mar 2019 14:37:18 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h1Xfa-0007SD-DM for pgsql-general@lists.postgresql.org; Wed, 06 Mar 2019 14:37:18 +0000 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h1XfX-0008Mk-Qa for pgsql-general@lists.postgresql.org; Wed, 06 Mar 2019 14:37:18 +0000 Received: by mail-pf1-x444.google.com with SMTP id d25so8760383pfn.8 for ; Wed, 06 Mar 2019 06:37:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=6ERFYuxGbVqoRZYciCivCr7h5zpJQROawna9howlalY=; b=txfDR0ZVWcx6ZJUzaDwF0hnagOy/hn/Gd2HI4mwqey0/DHhkd5YGDfWK/mkf+8jEkF HNiFVRh2lVASowmJdO04FgL2GUxRgn/BHYQLcgr96WDWdtb/jtk1Hnt363ByG/anC9ee gGXPo2gLuehpyr0xTNjQNZbOH1HUB9XFAYdBHRFNm11XwTdXlE2moG434ZQJQjwfY/uC BHFWG0O6Ck0BxSZVNVCad4zoPuhMAIgphYXXkEGYhosovexNe7E/EvEMkxthNTc546Kv TCIhfedyzow0shE5cHDn18pQsH2WKZcvgGTbM39J6n7A1I1801reQMsGUEzvyCoMkPBX HdJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=6ERFYuxGbVqoRZYciCivCr7h5zpJQROawna9howlalY=; b=KXvSNr8lejgaBuUzbcn//CP8LoEPyaTDAVo5izL4qj/HOPkwYI+SskdXOcV3dXu8d4 gQLI+rcB5HLSD5EbJF158acFllRp7CqtcIRkwgRMCob9JnPoYqgegk0DfNfjf9EYYNa3 mOEMyOYy2YLcUZZgveFDesDfnHE62OL/NY3W/Ahqlj/xDAEFSHtazckyZkTvJyEW/u4F IePqmU9Q/0Jj3VUmcU0d1qEY54ODsNlki9XiYiF7RaXsHfL9/uPNSytPg09e/waTIWcI HxcejzuMPj1WkG4+vUO2CDbLofLH8P1OmamDSt8DxeDrtbPmfmJEkvbjizLi6QLZx+98 RT9A== X-Gm-Message-State: APjAAAWlVxpXui65Vz28McRmNPfhOTxoi8z31pDbnJym8yrSkwMpceCv TdqkP8ZaPUs1v4vSnWF8L7e/8nnta34= X-Google-Smtp-Source: APXvYqyA8OJ1TMNdYbHji7/ai0t3Cn6UiYrY/F90dCYMVIHv9XWvLDnm5nIMeHZZ2gJZSEUxMKgjug== X-Received: by 2002:a63:4913:: with SMTP id w19mr6443104pga.394.1551883033558; Wed, 06 Mar 2019 06:37:13 -0800 (PST) Received: from [192.168.1.71] (d207-6-152-227.bchsia.telus.net. [207.6.152.227]) by smtp.gmail.com with ESMTPSA id i13sm3053384pfo.106.2019.03.06.06.37.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Mar 2019 06:37:13 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 12.2 \(3445.102.3\)) Subject: Re: query has no destination for result data From: Rob Sargent In-Reply-To: <16224.1551882543@sss.pgh.pa.us> Date: Wed, 6 Mar 2019 06:37:05 -0800 Cc: "pgsql-generallists.postgresql.org" Content-Transfer-Encoding: quoted-printable Message-Id: References: <16224.1551882543@sss.pgh.pa.us> To: Tom Lane X-Mailer: Apple Mail (2.3445.102.3) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk > On Mar 6, 2019, at 6:29 AM, Tom Lane wrote: >=20 > Rob Sargent writes: >> One of my plpgsql functions is now throwing this error: >=20 >> ERROR: query has no destination for result data >> HINT: If you want to discard the results of a SELECT, use PERFORM = instead. >> CONTEXT: PL/pgSQL function = optimal_pvalue_mono(text,text,integer,double precision,integer) line 65 = at SQL statement >=20 >> The code referenced at line 65 is the last line in a "for row in = query=E2=80=9D construct as follows: >> 54 for segp in >> 55 select s.id, s.firstmarker, s.lastmarker,=20 >> 56 v.ipv, >> 57 array_length(p.probands,1) as pbs, >> 58 s.lastmarker - s.firstmarker as mks >> 59 from segment s=20 >> 60 join imputed_pvalue_t v on s.id =3D = v.segment_id >> 61 join probandset p on s.probandset_id =3D p.id >> 62 join probandset_group_member m on p.id =3D = m.member_id >> 63 where s.markerset_id =3D mkset >> 64 and m.group_id =3D pbsgid >> 65 order by ipv, pbs, mks >> 66 LOOP >=20 > I think perhaps you've miscounted lines somehow, or are looking into > the wrong function. The "at SQL statement" bit indicates that plpgsql > thinks it's dealing with a run-of-the-mill SQL command, not a FOR = loop; > moreover, looking at the source code shows that "query has no = destination > for result data" is thrown only in exec_stmt_execsql, which ditto. >=20 > Another possibility, perhaps, is that there's some syntax error a = little > bit above what you've shown us, such that this stanza isn't being seen > as a FOR loop at all, but as more lines in a SQL command that started > earlier. I'm not entirely sure how such a case would have got past > parsing and into execution, but it's worth thinking about. >=20 > In any case, this isn't solvable with just what you've shown us here. >=20 > regards, tom lane Thank you sir, I shall keep digging. If it comes to that I can certainly = share all three functions involved. I presume the answer to the issue of = a zero row result is No it won=E2=80=99t cause this error. @Ron: Did you hit send a little early?