<div class="socmaildefaultfont" dir="ltr" style="font-family:Arial, Helvetica, sans-serif;font-size:10pt" ><div dir="ltr" ><br>Hi Dave,<br>
<div>We are using 42.2.11 and the latest JDBC driver. We also tried 42.2.16 JDBC drivers as well.</div><br>please note that getProcedures() returns nothing, which is expected as we do not have any Stored procedure.<br><br>but when we use getProcedureColumns(catalog, schema,null,null) then it returns the columns from Functions, which is unexpected and is a bug.<br><br>Thanks <br>Adarshdeep<br><br><br>----- Original message -----<br>From: Dave Cramer <davecramer(at)postgres(dot)rocks><br>To: adarshdeep(dot)cheema(at)ibm(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org<br>Cc:<br>Subject: [EXTERNAL] Re: BUG #16557: getProcedureColumns() function returns columns, when there is no existing Stored Procedure in the DB<br>Date: Tue, Sep 1, 2020 6:36 PM<br>
<div dir="ltr" >This has been fixed in
<div><a href="https://github.com/pgjdbc/pgjdbc/pull/1723" target="_blank">https://github.com/pgjdbc/pgjdbc/pull/1723</a></div>
<div>Please upgrade the driver
<div><div data-smartmail="gmail_signature" dir="ltr" ><div dir="ltr" >Dave Cramer
<div>www.postgres.rocks</div></div></div></div></div></div>
<div><div dir="ltr" >On Mon, 27 Jul 2020 at 13:47, PG Bug reporting form <<a href="mailto:noreply(at)postgresql(dot)org" target="_blank">noreply(at)postgresql(dot)org</a>> wrote:</div>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" >The following bug has been logged on the website:<br><br>Bug reference: 16557<br>Logged by: Adarshdeep Cheema<br>Email address: <a href="mailto:adarshdeep(dot)cheema(at)ibm(dot)com" target="_blank">adarshdeep(dot)cheema(at)ibm(dot)com</a><br>PostgreSQL version: 12.2<br>Operating system: Windows<br>Description: <br><br>Create any user defined function using Postgres 12.3 Server, we are using<br>postgresql-42.2.11 JDBC driver<br><br>DDLs:<br>CREATE FUNCTION findec(pdec numeric) RETURNS numeric<br> LANGUAGE plpgsql<br> AS $$<br>declare r decimal(7,2);<br>begin<br> r = PDEC;<br> return r;<br>end;<br>$$;<br><br><br>a) When we use the following Java code, then we get nothing as we do no have<br>any Stored Procedure defined, which is expected<br> resultSet= metadata.getProcedures(null , "public", null); ,<br> while (resultSet.next()){<br><br> System.out.print(resultSet.getString(1)+" ");<br> System.out.print(resultSet.getString(2)+" ");<br> System.out.print(resultSet.getString(3)+" ");<br> System.out.print(resultSet.getString(4)+" ");<br> System.out.print(resultSet.getString(5)+" ");<br> System.out.println(resultSet.getString(6)+" ");<br> }<br><br>b) Now change the JAVA code to the following and you will get two columns in<br>the resultSet, which is a bug as there is no StoredProcedure Defined in the<br>database<br><br> resultSet= metadata.getProcedureColumns(null , "public", "findec", null);<br>,<br> while (resultSet.next()){<br><br> System.out.print(resultSet.getString(1)+" ");<br> System.out.print(resultSet.getString(2)+" ");<br> System.out.print(resultSet.getString(3)+" ");<br> System.out.print(resultSet.getString(4)+" ");<br> System.out.print(resultSet.getString(5)+" ");<br> System.out.println(resultSet.getString(6)+" ");<br> }<br><br><br>OUTPUT:<br>null public findec returnValue 5 2 <br>null public findec pdec 1 2<br> </blockquote></div></div>
<div dir="ltr" > </div></div><BR>