Re: query has no destination for result data

From: Rob Sargent <robjsargent(at)gmail(dot)com>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: query has no destination for result data
Date: 2019-03-06 19:20:31
Message-ID: BA60CE0A-50B2-477A-8883-7CE13D1F4167@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> On Mar 6, 2019, at 10:29 AM, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> wrote:
>
> On 3/6/19 8:19 AM, Rob Sargent wrote:
>>> On Mar 6, 2019, at 7:41 AM, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com <mailto:adrian(dot)klaver(at)aklaver(dot)com>> wrote:
>>>
>>>> On 3/6/19 7:37 AM, Pavel Stehule wrote:
>>>>
>>>> or
>>>> \sf+ functioname
>>>
>>> Cool, I learned something new.
>>>
>>>> Regards
>>>> Pavel
>>>
>>>
>> using \ef function 65 puts the cursor on the first line of the loop. So a debugging statement got in the way! I don’t need the variables set other than to keep track of what’s going on in the loop. They’re gone now and so it the problem (and hopefully I’ll correct my ways).
>
> Where you maybe needing SELECT INTO?:
>
> https://www.postgresql.org/docs/10/plpgsql-statements.html#PLPGSQL-STATEMENTS-SQL-ONEROW
>
> So something like(not tested):
>
> select min(ordinal), max(ordinal) into imkr, jmkr from mrkidx where ordinal between segp.firstmarker and segp.lastmarker;
>
Quite likely but I really don’t need the assignment so the problem is gone.

>> Thank you all.
>> raise notice '%: added % segments to imputed_pvalue_t',
>> clock_timestamp(), rcount;
>> --
>> for segp in
>> select s.id <http://s.id>, s.firstmarker, s.lastmarker,
>> v.ipv,
>> array_length(p.probands,1) as pbs,
>> s.lastmarker - s.firstmarker as mks
>> from segment s
>> join imputed_pvalue_t v on s.id <http://s.id> = v.segment_id
>> join probandset p on s.probandset_id = p.id <http://p.id>
>> join probandset_group_member m on p.id <http://p.id> =
>> m.member_id
>> where s.markerset_id = mkset
>> and m.group_id = pbsgid
>> order by ipv, pbs, mks
>> LOOP
>> _select imkr=min(ordinal), jmkr=max(ordinal) from mrkidx where
>> ordinal between segp.firstmarker and segp.lastmarker;_
>> raise notice 'seg % start=% i=% end=% j=%', segp.id
>> <http://segp.id>, segp.firstmarker, imkr, segp.lastmarker, jmkr;
>> delete from mrkidx where ordinal between segp.firstmarker and
>> segp.lastmarker;
>> get diagnostics rcount = ROW_COUNT;
>> segsdone = segsdone + 1;
>> if rcount > 0 then
>> insert into collected values(segp.id <http://segp.id>,
>> segp.ipv);
>> totalinserts = totalinserts + rcount;
>> if totalinserts = mkrcnt then -- really totalDELETES
>> raise notice '%: no markers left on %th segment %',
>> clock_timestamp(), segsdone, segp.id <http://segp.id>;
>> exit;
>> end if;
>> end if;
>> end loop;
>>> --
>>> Adrian Klaver
>>> adrian(dot)klaver(at)aklaver(dot)com <mailto:adrian(dot)klaver(at)aklaver(dot)com>
>
>
> --
> Adrian Klaver
> adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2019-03-06 21:12:47 Re: write on standby
Previous Message Adrian Klaver 2019-03-06 19:18:48 Re: Monitor the ddl and dml activities in logs