Re: Fix hints on CREATE PROCEDURE errors - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Fix hints on CREATE PROCEDURE errors
Date
Msg-id ebac3f1b-50c8-2bc4-a565-2cdd6a13d72c@2ndquadrant.com
Whole thread Raw
In response to Fix hints on CREATE PROCEDURE errors  (Jeremy Evans <code@jeremyevans.net>)
Responses Re: Fix hints on CREATE PROCEDURE errors
List 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

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: REINDEX and shared catalogs
Next
From: Simon Muller
Date:
Subject: Re: Allow COPY's 'text' format to output a header