From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: unable to call a function |
Date: | 2013-07-04 18:19:34 |
Message-ID: | CAFj8pRAUeiq4qXARjWz-b2PYqkF=DRbhugYQZmSuXLQ2rzE78g@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hello
2013/7/4 Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>:
> 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);
>
there is wrong datatype
CREATE OR REPLACE FUNCTION check_if_if_exist(id integer, table_name
character, table_column character)
no "character" - use instead "text" or "varchar"
Regards
Pavel
> --
> Adrian Klaver
> adrian(dot)klaver(at)gmail(dot)com
>
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
From | Date | Subject | |
---|---|---|---|
Next Message | Stephen Carville | 2013-07-04 19:53:40 | Re: Cannot connect to remote postgres database |
Previous Message | Adrian Klaver | 2013-07-04 18:14:53 | Re: unable to call a function |