pgpsql help
От | LENGYEL Zoltan |
---|---|
Тема | pgpsql help |
Дата | |
Msg-id | 41EB431C.3070109@warnew.nomaam.hu обсуждение исходный текст |
Ответы |
Re: pgpsql help
Re: pgpsql help |
Список | pgsql-general |
Hi, I have a pgpsql function: create or replace function new_uri(varchar,varchar,varchar) returns integer as ' declare src alias for $1; tit alias for $2; uri alias for $3; article_id integer := nextval(''articleid''); src_id integer; state_id integer; urit_id integer; begin select into src_id id from sources where name = src; select into state_id id from state where name = ''collected''; select into urit_id id from uritype where name = ''original html''; raise notice ''insert into article (id,source,title,state) values (%,%,%,%)'',article_id,src_id,tit,state_id; insert into article (id,source,title,state) values (article_id,src_id,tit,state_id); raise notice ''insert into uri (articleid,uri,uritype) values (%,%,%)'',article_id,uri,urit_id; insert into uri (articleid,uri,uritype) values (article_id,uri,urit_id); return 1; end; ' language 'plpgsql'; An i also have some output: ifa=> \i new_uri.sql CREATE FUNCTION ifa=> select new_uri('index.hu','juscsenko','index.hu/foobar'); NOTICE: insert into article (id,source,title,state) values (56,3,juscsenko,1) NOTICE: insert into uri (articleid,uri,uritype) values (56,index.hu/foobar,3) ERROR: syntax error at or near "$1" at character 14 CONTEXT: PL/pgSQL function "new_uri" line 17 at SQL statement ifa=> What should i do? thx, War_New
В списке pgsql-general по дате отправления: