From: | "Jonathan S(dot) Katz" <jonathan(dot)katz(at)excoventures(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Jeremy Evans <code(at)jeremyevans(dot)net>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Fix hints on CREATE PROCEDURE errors |
Date: | 2018-08-18 18:09:22 |
Message-ID: | 31A8D0BD-52E2-4D47-8E66-E29D9020AEC6@excoventures.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> On Aug 8, 2018, at 3:18 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> writes:
>> Yes, the hint should be changed. But I also think the error message
>> should be changed to be more appropriate to the procedure situation
>> (where is the return type?). Attached patch does both. Unlike your
>> patch, I kept the "DROP FUNCTION" message for the function case. It
>> might be too confusing otherwise. Thoughts?
>
> I'm not a translator, but if I were, stuff like "Use DROP %s %s first."
> would probably confuse me. IMO it's too close to assembling a message
> out of parts, even if it's true that neither %s needs translation.
> I think you'd be better off with
>
> isprocedure ? errhint("Use DROP PROCEDURE %s first.", ...)
> : errhint("Use DROP FUNCTION %s first.", ...)
>
> Or if that seems too carpal-tunnel-inducing, maybe a workable compromise
> is
>
> dropcmd = (prokind == PROKIND_PROCEDURE ? "DROP PROCEDURE" : "DROP FUNCTION");
>
> /* translator: first %s is DROP FUNCTION or DROP PROCEDURE */
> errhint("Use %s %s first.", dropcmd, ...)
>
> Looks reasonable other than that quibble.
To help move this along, I went ahead and applied Tom’s first suggestion
to the patch. I tested the various scenarios and it seemed to work.
Jonathan
Attachment | Content-Type | Size |
---|---|---|
0001-Improve-error-messages-for-CREATE-OR-REPLACE-PROCEDU-v2.patch | application/octet-stream | 4.2 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Hongyuan Ma | 2018-08-18 18:10:34 | [GSoC] Summery of pg performance farm |
Previous Message | Jonathan S. Katz | 2018-08-18 17:37:59 | Re: Pre-v11 appearances of the word "procedure" in v11 docs |