Thread: BUG #8168: duplicated function signature

BUG #8168: duplicated function signature

From
vladimir.jovanovic@aparteko.com
Date:
The following bug has been logged on the website:

Bug reference:      8168
Logged by:          Vladimir Jovanovi=C4=87
Email address:      vladimir.jovanovic@aparteko.com
PostgreSQL version: 8.4.11
Operating system:   PostgreSQL 8.4.11 on x86_64-redhat-linux-gnu, com
Description:        =


Hi,

I noticed that I have two functions with the same signature.

sp_get_league_prediction(IN _id bigint, IN _rank integer, IN
_log_in_expectence double precision, IN _feathers_gained integer, IN
_tokens_all integer, IN _tokens_active integer, IN _score integer)

sp_get_league_prediction(_id bigint, _rank integer, _log_in_expectence
double precision, _feathers_gained integer, _tokens_all integer,
_tokens_active integer, _score integer)

Actually, I created first one with intention, but the second function
appeared when I executed the following code when I wanted to replace the
function:

CREATE OR REPLACE FUNCTION sp_get_league_prediction(IN _id bigint, IN _rank
integer, IN _log_in_expectence double precision, IN _feathers_gained
integer, IN _tokens_all integer, IN _tokens_active integer, IN _score
integer)
  RETURNS SETOF record AS
$BODY$
DECLARE
BEGIN

Re: BUG #8168: duplicated function signature

From
Heikki Linnakangas
Date:
On 17.05.2013 13:31, vladimir.jovanovic@aparteko.com wrote:
> I noticed that I have two functions with the same signature.
>
> sp_get_league_prediction(IN _id bigint, IN _rank integer, IN
> _log_in_expectence double precision, IN _feathers_gained integer, IN
> _tokens_all integer, IN _tokens_active integer, IN _score integer)
>
> sp_get_league_prediction(_id bigint, _rank integer, _log_in_expectence
> double precision, _feathers_gained integer, _tokens_all integer,
> _tokens_active integer, _score integer)

In addition to higher-level checks, there is a unique index in the
pg_proc catalog that should not let that happen, so to be honest, I find
that hard to believe. Are you 100% they have the same signature? Are
they in different schemas, perhaps? In psql, what does "\df
sp_get_league_prediction" return?

- Heikki

Re: BUG #8168: duplicated function signature

From
Tom Lane
Date:
Heikki Linnakangas <hlinnakangas@vmware.com> writes:
> On 17.05.2013 13:31, vladimir.jovanovic@aparteko.com wrote:
>> I noticed that I have two functions with the same signature.
>>
>> sp_get_league_prediction(IN _id bigint, IN _rank integer, IN
>> _log_in_expectence double precision, IN _feathers_gained integer, IN
>> _tokens_all integer, IN _tokens_active integer, IN _score integer)
>>
>> sp_get_league_prediction(_id bigint, _rank integer, _log_in_expectence
>> double precision, _feathers_gained integer, _tokens_all integer,
>> _tokens_active integer, _score integer)

> In addition to higher-level checks, there is a unique index in the
> pg_proc catalog that should not let that happen, so to be honest, I find
> that hard to believe. Are you 100% they have the same signature? Are
> they in different schemas, perhaps? In psql, what does "\df
> sp_get_league_prediction" return?

If they are in different schemas, you'd probably need
    \df *.sp_get_league_prediction
to see both.

            regards, tom lane

Re: BUG #8168: duplicated function signature

From
Heikki Linnakangas
Date:
On 17.05.2013 18:53, Vladimir Jovanovic wrote:
> Hi Heikki,
>
> Here you can find attached .csv semicolon separated made by :"SELECT * FROM
> pg_proc WHERE proname LIKE 'sp_get_league_prediction".
> "\df sp_get_league_prediction" is also attached.
>
> Both functions are returning the same setof record:
>
> ---------------------------
> CREATE OR REPLACE FUNCTION sp_get_league_prediction(IN _id bigint, IN _rank
> integer, IN _log_in_expectence double precision, IN _feathers_gained
> integer, IN _tokens_all integer, IN _tokens_active integer, IN _score
> integer)
>    RETURNS SETOF record AS
> $BODY$
> ...
> ---------------------------
> CREATE OR REPLACE FUNCTION sp_get_league_prediction(_id bigint, _rank
> integer, _log_in_expectence double precision, _feathers_gained integer,
> _tokens_all integer, _tokens_active integer, _score integer)
>    RETURNS SETOF record AS
> $BODY$
> ...

No. One of the functions was created with something like above. But the
other one takes no arguments, and *returns* a table with those columns.
Try "\ef sp_get_league_prediction()" to get a CREATE OR REPLACE FUNCTION
statement to recreate the latter; you will see that it looks something
like this:

CREATE OR REPLACE FUNCTION public.sp_get_league_prediction()
  RETURNS TABLE(id bigint, _rank integer, _log_in_expectence double
precision, _feathers_gained integer, _tokens_all integer, _tokens_active
integer, _score integer)
AS ...

- Heikki

Re: BUG #8168: duplicated function signature

From
Vladimir Jovanovic
Date:

			
		

Re: BUG #8168: duplicated function signature

From
Vladimir Jovanovic
Date:
Hi Heikki,

Here you can find attached .csv semicolon separated made by :"SELECT * FROM pg_proc WHERE proname LIKE 'sp_get_league_prediction".
"\df sp_get_league_prediction" is also attached.

Both functions are returning the same setof record:

---------------------------
CREATE OR REPLACE FUNCTION sp_get_league_prediction(IN _id bigint, IN _rank integer, IN _log_in_expectence double precision, IN _feathers_gained integer, IN _tokens_all integer, IN _tokens_active integer, IN _score integer)
  RETURNS SETOF record AS
$BODY$
...
---------------------------
CREATE OR REPLACE FUNCTION sp_get_league_prediction(_id bigint, _rank integer, _log_in_expectence double precision, _feathers_gained integer, _tokens_all integer, _tokens_active integer, _score integer)
  RETURNS SETOF record AS
$BODY$
...





On Fri, May 17, 2013 at 4:11 PM, Heikki Linnakangas <hlinnakangas@vmware.com> wrote:
On 17.05.2013 13:31, vladimir.jovanovic@aparteko.com wrote:
I noticed that I have two functions with the same signature.

sp_get_league_prediction(IN _id bigint, IN _rank integer, IN
_log_in_expectence double precision, IN _feathers_gained integer, IN
_tokens_all integer, IN _tokens_active integer, IN _score integer)

sp_get_league_prediction(_id bigint, _rank integer, _log_in_expectence
double precision, _feathers_gained integer, _tokens_all integer,
_tokens_active integer, _score integer)

In addition to higher-level checks, there is a unique index in the pg_proc catalog that should not let that happen, so to be honest, I find that hard to believe. Are you 100% they have the same signature? Are they in different schemas, perhaps? In psql, what does "\df sp_get_league_prediction" return?

- Heikki



--

Vladimir Jovanović

http://www.aparteko.com

CELL: +381 64 211 79 79

OFFICE: + 381 11 314 86 38

E-MAIL: vladimir.jovanovic@aparteko.com

Description: cid:image001.png@01CD3D1C.7D977930

setting standards in social gaming development

Attachment