Re: BUG #15057: Issue with UNKNOW type when calling a PostgreSQL function from java code

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Praveen Kumar <praveenkumar52028(at)gmail(dot)com>
Cc: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #15057: Issue with UNKNOW type when calling a PostgreSQL function from java code
Date: 2018-02-10 11:12:02
Message-ID: CAFj8pRAbzWwS4ayMZu0yBNrb_JM83zxJZPQNf+BFOXU7khSzOA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

2018-02-10 11:35 GMT+01:00 Praveen Kumar <praveenkumar52028(at)gmail(dot)com>:

> Hi Andrew,
>
> Thanks for picking up this,
> To have backward compatibility with my application (Specially queries)
>
> We have used orafce plugin, it created multiple DECODE functions with
> different parameters.
>
>
> [image: Inline image 2]
>
>
> While calling one of these DECODE functions from my existing select
> query,I am seeing an error saying
>
> decode(numeric,integer,unknown,unknow) is not available
>

you can see, there is used polymorphic type - "anyelement". You cannot to
derivate type from this type.

But you can define own decode function, where polymorphic type is not used
- inside you can use explicit typing and all should to work

Regards

Pavel

>
>
> By the way, PostgreSQL is allowing me to do method overloading,So I am
> able to write multiple functions with the same name and different parameters
>
>
>
> Thanks,
> Praveen
>
>
>
>
>
>
>
>
>
> On Sat, Feb 10, 2018 at 3:37 PM, Andrew Gierth <
> andrew(at)tao11(dot)riddles(dot)org(dot)uk> wrote:
>
>> >>>>> "PG" == PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
>>
>> PG> If I try to call a function as below
>>
>> PG> select myFunction(1,'This is unknown type',90.01,'Again a unknown
>> PG> type column');
>>
>> PG> It is raising an error like function myFunction(integer, unknown,
>> PG> double precision, unknown) does not exist.
>>
>> I think you need to be a bit more specific about what precisely you did,
>> because this is what I tried:
>>
>> create or replace function
>> myfunc(a integer, b text, c double precision, d text)
>> returns void language plpgsql
>> as $$ begin raise info 'myfunc called'; end; $$;
>>
>> select myfunc(1,'foo',90.01,'bar');
>> INFO: myfunc called
>>
>> In particular: do you have more than one function of the same name? Were
>> you actually calling the function from JDBC with parameters (and if so
>> what types) rather than as a plain select? Show us an exact transcript,
>> not just your editorialized summary.
>>
>> --
>> Andrew (irc:RhodiumToad)
>>
>
>

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Andrew Gierth 2018-02-10 11:48:17 Re: BUG #15057: Issue with UNKNOW type when calling a PostgreSQL function from java code
Previous Message Pavel Stehule 2018-02-10 10:45:18 Re: BUG #15057: Issue with UNKNOW type when calling a PostgreSQL function from java code