Hello!
I have problem with my function and I can find what's wrong.
WARNING: Error occurred while executing PL/pgSQL function fn_insert_entry _pending
WARNING: line 26 at SQL statement
ERROR: parser: parse error at or near "$1" at character 58
create or replace function "fn_insert_entr y_pending"(varc har,varchar,var char,varchar,va rchar,boolean,b oolean,date,int ,int) returns integer as '
declare
email alias for $1;
caption alias for $2;
description alias for $3;
keywords alias for $4;
url alias for $5;
is_company alias for $6;
is_novelty alias for $7;
expire alias for $8;
category1 alias for $9;
category2 alias for $10;
tmp record;
id_entry_tmp integer;
begin
SELECT INTO tmp id_user FROM "user" WHERE id_user = email;
if not found then
execute ''INSERT INTO "user" (id_user) VALUES ('' || quote_literal(e mail) || '')'';
end if;
select into id_entry_tmp id_entry from "directory_entr y" where url=url and is_novelty=is_n ovelty;
DELETE FROM "directory_entr y_pending" WHERE "url"=url and "id_entry"=id_e ntry_tmp and "is_novelty"=is _novelty;
INSERT INTO "directory_entr y_pending" (id_entry,id_us er,caption,url, is_company,is_n ovelty,expire,h ash) VALUES (id_entry_tmp,$ 1,$2,$5,$6,$7,$ 8,''1'');
return 1;
end;
' language 'plpgsql';
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings
I have problem with my function and I can find what's wrong.
WARNING: Error occurred while executing PL/pgSQL function fn_insert_entry _pending
WARNING: line 26 at SQL statement
ERROR: parser: parse error at or near "$1" at character 58
create or replace function "fn_insert_entr y_pending"(varc har,varchar,var char,varchar,va rchar,boolean,b oolean,date,int ,int) returns integer as '
declare
email alias for $1;
caption alias for $2;
description alias for $3;
keywords alias for $4;
url alias for $5;
is_company alias for $6;
is_novelty alias for $7;
expire alias for $8;
category1 alias for $9;
category2 alias for $10;
tmp record;
id_entry_tmp integer;
begin
SELECT INTO tmp id_user FROM "user" WHERE id_user = email;
if not found then
execute ''INSERT INTO "user" (id_user) VALUES ('' || quote_literal(e mail) || '')'';
end if;
select into id_entry_tmp id_entry from "directory_entr y" where url=url and is_novelty=is_n ovelty;
DELETE FROM "directory_entr y_pending" WHERE "url"=url and "id_entry"=id_e ntry_tmp and "is_novelty"=is _novelty;
INSERT INTO "directory_entr y_pending" (id_entry,id_us er,caption,url, is_company,is_n ovelty,expire,h ash) VALUES (id_entry_tmp,$ 1,$2,$5,$6,$7,$ 8,''1'');
return 1;
end;
' language 'plpgsql';
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings
Comment