Обсуждение: Build from file syntax troublem.
Hello, All!
I have to fiil datebase from file contains strings alike such:
CREATE SEQUENCE public.blacklist_id_seq INCREMENT 1 MINVALUE 1
MAXVALUE2147483647 CACHE 1;
and
CREATE FUNCTION public.from_days(int4) RETURNS timestamp AS '
select ''0000-01-02''::timestamp + ($1 || '' days'')::interval as result
' LANGUAGE 'sql' VOLATILE;
The parser abuse that
'parse error at or near '"." ',
'parse error at or near "public'" ',
'parse error at or near "#'" '.
PostgeSQL version is 7.2.3.
I've nowhere found isuch syntax in the net (I mean with dot -
'public.funcname(...)').
There is plpgsql only in the database;
When I try
./createlang -dbname=mydb sql
it says "unsupported language".
But SELECT * FROM pg_language
show that it's present.
Where I'm wrong?
Successes & good luck for all,
Igor
Igor Radtchenko <inta@komi.parma.ru> writes:
> CREATE FUNCTION public.from_days(int4) RETURNS timestamp AS '
> select ''0000-01-02''::timestamp + ($1 || '' days'')::interval as result
> ' LANGUAGE 'sql' VOLATILE;
> The parser abuse that
> 'parse error at or near '"." ',
> 'parse error at or near "public'" ',
> 'parse error at or near "#'" '.
> PostgeSQL version is 7.2.3.
You need 7.3 or later to deal with schema-aware commands.
regards, tom lane
Hello Tom, Thank you very much for such fast reply. But now, after I've installed 8.0.1, it says things as examples in little attach. <------ Where I have to dig?.. :( Sunday, March 06, 2005, 2:38:26 AM, you wrote: TL> Igor Radtchenko <inta@komi.parma.ru> writes: >> CREATE FUNCTION public.from_days(int4) RETURNS timestamp AS ' >> select ''0000-01-02''::timestamp + ($1 || '' days'')::interval as result >> ' LANGUAGE 'sql' VOLATILE; >> The parser abuse that >> 'parse error at or near '"." ', >> 'parse error at or near "public'" ', >> 'parse error at or near "#'" '. >> PostgeSQL version is 7.2.3. TL> You need 7.3 or later to deal with schema-aware commands. TL> regards, tom lane -- Best regards, Radtchenko mailto:inta@komi.parma.ru
Вложения
Radtchenko Igor <inta@komi.parma.ru> writes:
> But now, after I've installed 8.0.1, it says things as examples in
> little attach.
> freenibs=# CREATE FUNCTION public.if(int4, int4, int4) RETURNS int4 AS '
> freenibs'# DECLARE
> freenibs'# expr1 ALIAS FOR $1;
> freenibs'# expr2 ALIAS FOR $2;
> ...
> freenibs'# END;
> freenibs'# ' LANGUAGE 'sql' VOLATILE;
> ERROR: syntax error at or near "ALIAS" at character 78
> LINE 3: expr1 ALIAS FOR $1;
That's a plpgsql function, not an sql function. Your other examples
look like they were taken from some other database that has different
extensions to the SQL spec than we do: there is no "varchar binary"
in Postgres, and we don't allow you to add random commas at the ends
of column lists. PG isn't going to like '0000-00-00' for a date,
either.
regards, tom lane