Why is this postgres function failing only on one specifc database?

Posted by Ollie Edwards on Stack Overflow See other posts from Stack Overflow or by Ollie Edwards
Published on 2012-11-07T10:58:58Z Indexed on 2012/11/07 10:59 UTC
Read the original article Hit count: 215

Filed under:

I'm trying to fix an issue with a legacy database. The quote_literal function is not working for a specific database on an 8.4 install of postgres.

Here's my results on a fresh test database:

select quote_literal(42);
 quote_literal 
---------------
 '42'
(1 row)

And now the same on the target db

select quote_literal(42);
ERROR:  function quote_literal(integer) is not unique
LINE 1: select quote_literal(42);
           ^
HINT:  Could not choose a best candidate function. You might need to add explicit type casts.

AIUI, the quote_literal(anyvalue) function should handle integer values ok, and this seems to be upheld by the first test.

So I figured the quote_literal function must have been overridden in this db but no this doesn't seem to be the case. I could override it with a specific quote_literal(integer) function but I don't see why I should have to.

The question is what is could be causing the failure of this function in this specific database whilst not affecting the fresh db?

© Stack Overflow or respective owner

Related posts about postgresql