function to create a table

Поиск
Список
Период
Сортировка
От diana@softwaresolutions.ro
Тема function to create a table
Дата
Msg-id 200103300609.f2U69Uf16249@softwaresolutions.ro
обсуждение исходный текст
Список pgsql-general
Good day,
I have a problem with plpgsql, whitch is really strange for me.
I wanna create a table, with a function like this :

CREATE FUNCTION domenii(text,text,text)
RETURNS boolean
AS 'DECLARE
        legi ALIAS FOR $2;
BEGIN
        CREATE TABLE legi(idc serial, idp char(10), nume char(50), PRIMARY
KEY(idc));
                RETURN ''t'';
END;'
LANGUAGE 'plpgsql';

the error message from psql is :

select domenii('gigi','gigi1','gigi2');
ERROR:  parser: parse error at or near "$1"

and the postgres error message is

010330.08:16:53.385  [9931] ERROR:  parser: parse error at or near "$1"
010330.08:16:53.385  [9931] DEBUG:  Last error occured while executing
PL/pgSQL function domenii
010330.08:16:53.386  [9931] DEBUG:  line 4 at SQL statement

my question is.
Why is asking me about $1 wenn i don't have this in my function, it seems to be a problem with create table.
Thanks you very much.

Diana Cionoiu


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

Предыдущее
От: Maurizio Ortolan
Дата:
Сообщение: Error in the date field (with NULL value...).Thanks!
Следующее
От: "Vilson farias"
Дата:
Сообщение: Re: enable pl/pgsql in postgres from postgres-server-7.0.3-2 RPM