Problem running or executing a function in Postgresql

Поиск
Список
Период
Сортировка
От Venki
Тема Problem running or executing a function in Postgresql
Дата
Msg-id 43169F8B.00000A.00960@VENKI
обсуждение исходный текст
Ответы Re: Problem running or executing a function in Postgresql  (Richard Huxton <dev@archonet.com>)
Re: Problem running or executing a function in Postgresql  (Michael Fuhr <mike@fuhr.org>)
Список pgsql-general
 Hi,
 
I have a table named mydata

CREATE TABLE public.mydata (

id int4 DEFAULT nextval('public.mydata_id_seq'::text) NOT NULL,

name varchar(50)

) WITH OIDS;

 

and I have a function as follows

CREATE OR REPLACE FUNCTION insertmydata(varchar) RETURNS int

as '

declare

new_id integer;

begin

INSERT INTO mydata("name") values($1);

new_id = EXECUTE("SELECT FROM currval("mydata_id_seq")");

return new_id;

end;

'

LANGUAGE 'PLPGSQL';

 

when I run the function as

select insertmydata('Venkatesh')

 

I am getting the following error message

"ERROR:  syntax error at or near "mydata_id_seq" at character 39"

can anyone help me in solving the above problem. Am I missing something here? How should I run the function to insert data?

I am using postgresql version 7.4.6 in a linux box and running pgadmin from a Winxp PC.

 
Kind Regards,
Venki

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

Предыдущее
От: Art Fore
Дата:
Сообщение: syslog message I do not understand
Следующее
От: David Sankel
Дата:
Сообщение: Re: Removing all users from a group