From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Rob Sargent <robjsargent@gmail.com>
Cc: pgsql-general <pgsql-general@lists.postgresql.org>
Subject: Re: query has no destination for result data
Date: Wed, 6 Mar 2019 10:29:18 -0800
Message-ID: <2c864cf1-97d6-e3ec-4928-24958da27e94@aklaver.com> (raw)
In-Reply-To: <14E03299-EEAD-45F0-A2B6-BF12F7218962@gmail.com>
References: <A8036BFA-C490-4E2E-819D-BD655CDAC364@gmail.com>
<56fdbfbb-c0ed-3aa0-3815-eef3545e5419@gmail.com>
<FE45B577-73A8-4AD4-A31E-F57862D5CD2A@gmail.com>
<e75c3c9b-20fa-0b4d-a9ed-3b398082787c@aklaver.com>
<CAFj8pRBY5DOfE1O_+ZbK4B6TP7VxccQy73kF_+u-1dCo+VhcyQ@mail.gmail.com>
<e33623e2-6fad-7c18-f7b9-0a1cf6a784e9@aklaver.com>
<14E03299-EEAD-45F0-A2B6-BF12F7218962@gmail.com>
On 3/6/19 8:19 AM, Rob Sargent wrote:
>
>
>> On Mar 6, 2019, at 7:41 AM, Adrian Klaver <adrian.klaver@aklaver.com
>> <mailto:adrian.klaver@aklaver.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;
> 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.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
>
--
Adrian Klaver
adrian.klaver@aklaver.com
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-general@postgresql.org
Cc: adrian.klaver@aklaver.com, robjsargent@gmail.com
Subject: Re: query has no destination for result data
In-Reply-To: <2c864cf1-97d6-e3ec-4928-24958da27e94@aklaver.com>
References: <A8036BFA-C490-4E2E-819D-BD655CDAC364@gmail.com> <56fdbfbb-c0ed-3aa0-3815-eef3545e5419@gmail.com> <FE45B577-73A8-4AD4-A31E-F57862D5CD2A@gmail.com> <e75c3c9b-20fa-0b4d-a9ed-3b398082787c@aklaver.com> <CAFj8pRBY5DOfE1O_+ZbK4B6TP7VxccQy73kF_+u-1dCo+VhcyQ@mail.gmail.com> <e33623e2-6fad-7c18-f7b9-0a1cf6a784e9@aklaver.com> <14E03299-EEAD-45F0-A2B6-BF12F7218962@gmail.com> <2c864cf1-97d6-e3ec-4928-24958da27e94@aklaver.com>
* 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