Re: Error message with plpgsql CONTINUE - Mailing list pgsql-hackers

From Jim Nasby
Subject Re: Error message with plpgsql CONTINUE
Date
Msg-id 55DC8ED3.4040407@BlueTreble.com
Whole thread Raw
In response to Re: Error message with plpgsql CONTINUE  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Error message with plpgsql CONTINUE  (Jim Nasby <Jim.Nasby@BlueTreble.com>)
Re: Error message with plpgsql CONTINUE  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 8/22/15 2:53 PM, Tom Lane wrote:

> This message seems confusing: label "lab1" does exist, it's just not
> attached to the right loop.  In a larger function that might not be too
> obvious, and I can easily imagine somebody wasting some time before

Agreed.

> figuring out the cause of his problem.  Given the way the namespace data
> structure works, I am not sure that we can realistically detect at line 8
> that there was an instance of lab1 earlier, but perhaps we could word the

Are there any other reasons we'd want to improve the ns stuff? Doesn't 
seem worth it for just this case, but if there were other nitpicks 
elsewhere maybe it is.

> error message to cover either possibility.  Maybe something like "there is
> no label "foo" surrounding this statement"?

"surrounding" seems pretty nebulous. Maybe "no label "foo" in this 
context"? I'd say we use the term block, but we differentiate between 
blocks and loops. Perhaps it would be best to document namespaces and 
make it clear that blocks and loops both use them. :/

Regardless of that, a hint is probably warranted. "Is "foo" a label for 
an adjacent block or loop?"?

> This is not too accurate, as shown by the fact that the first EXIT is
> accepted.  Perhaps "EXIT without a label cannot be used outside a loop"?

+1

> I realize that this is pretty nitpicky, but if we're going to all the
> trouble of improving the error messages about these things, seems like
> we ought to be careful about what the messages actually say.

Agreed.
-- 
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com



pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: WIP: Rework access method interface
Next
From: Jeff Janes
Date:
Subject: Re: Resource Owner reassign Locks