Roland Szabo (szroland@freemail.hu) reports a bug with a severity of 2
The lower the number the more severe it is.
Short Description
Fails to add function from file with \i in psql
Long Description
For maintainance reasons, sql statements for our databases are saved in files, and upon installation, are executed via
\ifile.sql from psql. In postgres 7.3, we've encountered the following problem:
In file trigger.sql, we create a trigger, and the function to be executed. (The list is in the example code part).
We execute this with \i trigger.sql. No problems so far. Trying a simple insert statement though (from
triggertest.sql):
insert into pszlfej
(szsuf, szsth, szsui, szuuf, szuth, szuui)
values
(1,1,1,1,1,1);
yields to an error:
psql:triggertest.sql:4: NOTICE: plpgsql: ERROR during compile of c_fnc
near line 1
"sql:triggertest.sql:4: ERROR: parse error at or near "
You say, there must be a syntax error in trigger.sql. But if we copy-paste the content of trigger.sql into psql, and
executeit there (same as typing it), the function and trigger are created, and the insert statement also works.
That means, the statements work just fine, and the error is most likely to be in psql.
Sample Code
trigger.sql:
drop function c_fnc();
create function c_fnc() returns opaque as '
begin
new.cdat := ''now'';
new.cusr := getpgusername();
return new;
end;
' language 'plpgsql';
drop trigger pszt_c_trig on pszltet;
create trigger pszt_c_trig before insert
on pszltet for each row execute procedure c_fnc();
No file was uploaded with this report