Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id C38ED1337999 for ; Fri, 31 Dec 2010 10:43:57 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 92172-02 for ; Fri, 31 Dec 2010 14:43:52 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ey0-f174.google.com (mail-ey0-f174.google.com [209.85.215.174]) by mail.postgresql.org (Postfix) with ESMTP id EB974133798E for ; Fri, 31 Dec 2010 10:43:49 -0400 (AST) Received: by eye27 with SMTP id 27so5277297eye.19 for ; Fri, 31 Dec 2010 06:43:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:from:to:cc :in-reply-to:references:content-type:date:message-id:mime-version :x-mailer:content-transfer-encoding; bh=SAwl57c5fxPZYvbFYgjpHDIVuv/+kyWP90LJ0O161XA=; b=fy6xg5ewOTMIKJLQp0F9nISJGYXJmKIM93xNHPcH2hDnWWPq5XzddmpCip0oA8syxp tLlOqQEVk+T9SG0Kr//Tr1oUZuC/HamhHWTdHkgR50D6+Z7wE9rFc9TxADfMBOPsFmch zDpTv8jI87dU2S1aonlDhE5yu5Buk5Zhd6N2Y= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:to:cc:in-reply-to:references:content-type:date :message-id:mime-version:x-mailer:content-transfer-encoding; b=V4eD13rmhzJaBQhHcVpAsnoP2cJMy5NipyFa/XlBy0ht9kXoq/pqcXXPkW2ecYPsU5 WK2ZAiVxryqZUOdknyHQnQOikdp5xP8zpB2u7lI/b6EWXUmeXWY4sPoIsmhyqqVNAJ+k BREneeUQHQWbbZriGz/JENhcvUSc8xVtnVFpk= Received: by 10.213.13.14 with SMTP id z14mr13233389ebz.52.1293806629629; Fri, 31 Dec 2010 06:43:49 -0800 (PST) Received: from [192.168.0.100] (238.80-202-60.nextgentel.com [80.202.60.238]) by mx.google.com with ESMTPS id t5sm12336164eeh.8.2010.12.31.06.43.47 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 31 Dec 2010 06:43:48 -0800 (PST) Subject: Re: java.sql.DatabaseMetaData.getProcedures and overloaded functions From: Thor Michael =?ISO-8859-1?Q?St=F8re?= To: Kris Jurka Cc: pgsql-jdbc@postgresql.org In-Reply-To: References: <1293738434.11427.34.camel@localhost> Content-Type: text/plain; charset="UTF-8" Date: Fri, 31 Dec 2010 15:43:47 +0100 Message-Id: <1293806627.4629.42.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.26.1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.598 tagged_above=-10 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RFC_ABUSE_POST=0.001 X-Spam-Level: X-Archive-Number: 201012/92 X-Sequence-Number: 21330 On Thu, 2010-12-30 at 22:24 -0500, Kris Jurka wrote: > > On Thu, 30 Dec 2010, Thor Michael St?re wrote: > > > Is my understanding correct in that JDBC doesn't actually provide a > > proper way of inspecting overloaded stored procedures, and so to get > > that information reliably you should query the PostgreSQL system > > catalogs? At least when I try to use the java.sql.DatabaseMetaData > > getProcedures and getProcedureColumns methods on overloaded procedures I > > see them repeated without any explicit distinction between them, except > > of course that getProcedureColumns gives different datatypes for each > > procedure. > > > > Hmm, the JDBC4 spec has added an additional column to the getProcedures > return value called SPECIFIC_NAME which might be for differentiating > between overloaded functions. Right, it says it should "uniquely" identify the function within the schema, which as far as I can tell means that for overloaded functions it would have to list up the input argument types. (Or at least the other only unique way to identify a function I can think of is the OID, which I can't believe one would want there.) Given: CREATE FUNCTION myfunction(in integer,in varchar, out timestamp) RETURNS ... It could perhaps return "myfunction(integer,varchar)". That would incidentally be something that identified a specific function for an ALTER/DROP FUNCTION command. > It's not clear whether the function is > supposed to be callable by that specific name or not. It's also awkard to > use because you can't pass the SPECIFIC_NAME from getProcedures to > getProcedureColumns, so you'd have to do your own filtering of that > ResultSet. True. In my case however I just need to find all the functions that matches a given name and their respective parameter types, so come to think of it getProcedureColumns alone would be sufficient if it gave a proper result for SPECIFIC_NAME that I could use just to map it on. Thanks, Thor Michael Støre