Re: [GENERAL] ERROR: query returned no rows - Mailing list pgsql-general

From Paul Jungwirth
Subject Re: [GENERAL] ERROR: query returned no rows
Date
Msg-id c4d97388-fb6a-5ebf-6cc2-ec344617c7f6@illuminatedcomputing.com
Whole thread Raw
In response to [GENERAL] ERROR: query returned no rows  (Alexander Farber <alexander.farber@gmail.com>)
Responses Re: [GENERAL] ERROR: query returned no rows  (Adrian Klaver <adrian.klaver@aklaver.com>)
List pgsql-general
On 06/26/2017 11:21 AM, Alexander Farber wrote:
> The error message returned by
> the database is rather cryptic:
>
> words=> select * from words_skip_game(1, 1);
> ERROR:  query returned no rows
> CONTEXT:  PL/pgSQL function words_skip_game(integer,integer) line 85 at
> SQL statement
>
> When I look at my source code
> ( https://gist.github.com/afarber/cac9a83b7a37307ace8d787be9b8ff4c ) at
> the line 85, then I am not sure if the line number reported by the error
> message is correct, because it points into middle of an UPDATE statement:

I agree the line numbers for error messages inside of plpgsql functions
never seem to make sense, so I wouldn't get too hung up on line 85.
Perhaps you should see what is line 85 when you do `\sf words_skip_game`
(rather than line 85 in your own source code). But mostly I would try to
find some other way of locating the cause of the error.

You can read about the "query returned no rows" message here:

https://www.postgresql.org/docs/9.5/static/plpgsql-statements.html

It seems to me you should only see it for `INTO STRICT`, not plain
`INTO`. I see from your gist that your function *does* have some queries
that are `INTO STRICT`, so I would focus on those.

That page also describes how to use `print_strict_params` to get a
little more info about the details of the error.

I hope that helps!

Paul


pgsql-general by date:

Previous
From: Alexander Farber
Date:
Subject: Re: [GENERAL] ERROR: query returned no rows
Next
From: Adrian Klaver
Date:
Subject: Re: [GENERAL] ERROR: query returned no rows