Re: unable to call a function

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: unable to call a function
Дата
Msg-id 51D5BB9D.5020903@gmail.com
обсуждение исходный текст
Ответ на Re: unable to call a function  (giozh <giozh@yahoo.it>)
Ответы Re: unable to call a function  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-general
On 07/04/2013 10:14 AM, giozh wrote:
> something gone wrong the same...
>
> REATE OR REPLACE FUNCTION check_if_if_exist(id integer, table_name
> character, table_column character)
>    RETURNS boolean AS
> $BODY$
>
> DECLARE res BOOLEAN;
>
> BEGIN
>     EXECUTE 'SELECT EXISTS(SELECT * FROM'||table_name||
>         'WHERE'||table_column||'='||$1||')' INTO res USING id;
>     RETURN res;
> END;
>
> select check_if_exist(10, 'prova', 'identificatore');
>
>
> RROR:  function check_if_exist(integer, unknown, unknown) does not exist
> LINE 1: select check_if_exist(10, 'prova', 'identificatore');
>                 ^
> HINT:  No function matches the given name and argument types. You might need
> to add explicit type casts.
>

Got hung up on the function definition and skipped over the error
message. Looks like Postgres is not seeing 'prova' and 'identificatore'
as text.

What happens if you do?:


select check_if_exist(10, 'prova'::text, 'identificatore'::text);

--
Adrian Klaver
adrian.klaver@gmail.com


В списке pgsql-general по дате отправления:

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: unable to call a function
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: unable to call a function