pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Rob Sargent <robjsargent@gmail.com>
To: Ron <ronljohnsonjr@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: query has no destination for result data
Date: Wed, 6 Mar 2019 07:27:14 -0800
Message-ID: <e75c3c9b-20fa-0b4d-a9ed-3b398082787c@aklaver.com> (raw)
In-Reply-To: <FE45B577-73A8-4AD4-A31E-F57862D5CD2A@gmail.com>
References: <A8036BFA-C490-4E2E-819D-BD655CDAC364@gmail.com>
	<56fdbfbb-c0ed-3aa0-3815-eef3545e5419@gmail.com>
	<FE45B577-73A8-4AD4-A31E-F57862D5CD2A@gmail.com>

On 3/6/19 7:12 AM, Rob Sargent wrote:
> 
> 
>> On Mar 6, 2019, at 6:32 AM, Ron <ronljohnsonjr@gmail.com> wrote:
>>
>> On 3/6/19 1:45 AM, Rob Sargent wrote:
>> [snip]
>>> This construct had been working until recent changes but I cannot relate the message to any deformity in the current schema or code.
>>> Any pointers appreciated.
>>
>> What were the recent changes?
>>
>> -- 
>> Angular momentum makes the world go 'round.
>>
> 
> diff optimalMonoPed.sql  optimalMonoPed.sql.~20359ea9e67ddf009db89b94140f67988862f247~
> 13,14d12
> <   imkr          int;
> <   jmkr          int;
> 53c51
> < --
> ---
>> --
> 67,68d64
> <     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, segp.firstmarker, imkr, segp.lastmarker, jmkr;
> 
> In other words two variables dropped along with the select which set them for their only use in a NOTICE, plus white space on a comment line.
> 
> So yes the problem must be in the caller.
> 
> A not on line numbers: Using \ef on this function presents a slight variation of my code: it rearranges the “language plpgsql” from after the final END; (old style I guess) to before the AS.  So line 65 is actually what I thought was line 64.

I believe language plpgsql is not considered part of the function body 
so it is not included in the line count:

https://www.postgresql.org/docs/10/plpgsql-structure.html

When tracking a line number down I usually do:

\ef some_function line_number

which counts the line in the function body not the file. So for example:

Using set nu in Vi:

1 CREATE OR REPLACE FUNCTION public.ts_update()
2  RETURNS trigger
3  LANGUAGE plpgsql
4 AS $function$
5 BEGIN
6     NEW.ts_update := timeofday();
7 RETURN NEW;
8 END;
9 $function$

\ef ts_update 4

CREATE OR REPLACE FUNCTION public.ts_update()
  RETURNS trigger
  LANGUAGE plpgsql
AS $function$
BEGIN
     NEW.ts_update := timeofday();
RETURN NEW;  <--- This row is marked
END;
$function$



> Still not the real problem of course.  (I’ll update my ways re: coding functions)
> 
> 
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com




view thread (12+ messages)  latest in thread

Message-ID: <e75c3c9b-20fa-0b4d-a9ed-3b398082787c@aklaver.com>
Permalink:  ../e75c3c9b-20fa-0b4d-a9ed-3b398082787c@aklaver.com/
Also on:    postgresql.org/message-id/e75c3c9b-20fa-0b4d-a9ed-3b398082787c@aklaver.com

 · 

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-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, robjsargent@gmail.com, ronljohnsonjr@gmail.com
  Subject: Re: query has no destination for result data
  In-Reply-To: <e75c3c9b-20fa-0b4d-a9ed-3b398082787c@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>

* 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