Re: [GENERAL] unable to call a function

2013-07-07 Thread giozh
ok, now it works with varchar args. thanks -- View this message in context: http://postgresql.1045698.n5.nabble.com/unable-to-call-a-function-tp5762590p5762891.html Sent from the PostgreSQL - general mailing list archive at Nabble.com. -- Sent via pgsql-general mailing list (pgsql-general@p

Re: [GENERAL] unable to call a function

2013-07-05 Thread Adrian Klaver
On 07/05/2013 12:29 AM, giozh wrote: so thanks to all for the answers. But i'm going to be frustrated, no one of your solutions seems to work, and i can't understand why, because i've write another two functions that works well... I always obtain error: or unknown function (if i pass args without

Re: [GENERAL] unable to call a function

2013-07-05 Thread giozh
so thanks to all for the answers. But i'm going to be frustrated, no one of your solutions seems to work, and i can't understand why, because i've write another two functions that works well... I always obtain error: or unknown function (if i pass args without ' ') or "column not exist". i've notic

Re: [GENERAL] unable to call a function

2013-07-04 Thread Pavel Stehule
Hello 2013/7/4 Adrian Klaver : > 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 >>

Re: [GENERAL] unable to call a function

2013-07-04 Thread Adrian Klaver
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||

Re: [GENERAL] unable to call a function

2013-07-04 Thread Adrian Klaver
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||

Re: [GENERAL] unable to call a function

2013-07-04 Thread giozh
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||'='||$

Re: [GENERAL] unable to call a function

2013-07-04 Thread Adrian Klaver
On 07/04/2013 09:33 AM, giozh wrote: ok, i've modify mi function, but now i'm not able to execute it: SELECT check_if_exist(10, table, col); ERROR: column "table" does not exist test=> select check_if_if_exist(1, 'int_test', 'i'); check_if_if_exist --- t (1 row) You nee

Re: [GENERAL] unable to call a function

2013-07-04 Thread giozh
ok, i've modify mi function, but now i'm not able to execute it: SELECT check_if_exist(10, table, col); ERROR: column "table" does not exist -- View this message in context: http://postgresql.1045698.n5.nabble.com/unable-to-call-a-function-tp5762590p5762600.html Sent from the PostgreSQL -

Re: [GENERAL] unable to call a function

2013-07-04 Thread giozh
ok, i've modify mi function, but now i'm not able to execute it: SELECT check_if_exist(10, table, col); ERROR: column "table" does not exist -- View this message in context: http://postgresql.1045698.n5.nabble.com/unable-to-call-a-function-tp5762590p5762599.html Sent from the PostgreSQL - ge

Re: [GENERAL] unable to call a function

2013-07-04 Thread Adrian Klaver
On 07/04/2013 08:53 AM, giozh wrote: i've write this function that search if inside a specified table there's a specified value: CREATE FUNCTION check_if_if_exist(id INTEGER, table_name character(50), table_column character(20) ) RETURNS BOOLEAN AS $$ BEGIN RETURN EXECUTE 'SELECT EXISTS

Re: [GENERAL] unable to call a function

2013-07-04 Thread Moshe Jacobson
You are passing the literal value "table_name" as the table, and "column_name" as the column. You need to concatenate the substituted values onto the string with the || operator: return execute 'select exists(select * from ' || quote_ident(table_name) || ' where ' || quote_ident(table_column) || '

[GENERAL] unable to call a function

2013-07-04 Thread giozh
i've write this function that search if inside a specified table there's a specified value: CREATE FUNCTION check_if_if_exist(id INTEGER, table_name character(50), table_column character(20) ) RETURNS BOOLEAN AS $$ BEGIN RETURN EXECUTE 'SELECT EXISTS(SELECT * FROM table_name WHERE table