Re: Fix hints on CREATE PROCEDURE errors

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: Jeremy Evans <code(at)jeremyevans(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Fix hints on CREATE PROCEDURE errors
Date: 2018-08-08 18:49:05
Message-ID: ebac3f1b-50c8-2bc4-a565-2cdd6a13d72c@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 06/08/2018 20:32, Jeremy Evans wrote:
> The current code's hint is misleading for procedures:
>
> CREATE OR REPLACE PROCEDURE a(in int)
> LANGUAGE SQL
> AS $$
> SELECT NULL;
> $$;
> # CREATE PROCEDURE
>
> CREATE OR REPLACE PROCEDURE a(inout int)
> LANGUAGE SQL
> AS $$
> SELECT NULL;
> $$;
> # ERROR: cannot change return type of existing function
> # HINT: Use DROP FUNCTION a(integer) first.

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?

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment Content-Type Size
0001-Improve-error-messages-for-CREATE-OR-REPLACE-PROCEDU.patch text/plain 3.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Muller 2018-08-08 18:57:33 Re: Allow COPY's 'text' format to output a header
Previous Message Tom Lane 2018-08-08 18:39:00 Re: REINDEX and shared catalogs