I am trying to execute the following script using the PgSqlScript component :-
Code: Select all
CREATE OR REPLACE FUNCTION grant_std_user (IN text)
RETURNS bool AS
$BODY$
begin
EXECUTE 'GRANT ALL ON ' || $1 || ' to std_user';
return TRUE;
end;
$BODY$
LANGUAGE PLpgSQL
CALLED ON NULL INPUT
VOLATILE
EXTERNAL SECURITY INVOKER;
CREATE OR REPLACE FUNCTION before_post_record ()
RETURNS trigger AS
$BODY$
DECLARE
staff_id int4;
BEGIN
staff_id := current_staff_id();
if (TG_OP = 'INSERT') THEN
if (NEW.id IS NULL) THEN
NEW.ID := generate_id();
END IF;
NEW.createdon := current_timestamp;
NEW.createdby_staff_id := staff_id;
END IF;
NEW.updatedon := current_timestamp;
NEW.updatedby_staff_id := staff_id;
RETURN NEW;
END;
$BODY$
LANGUAGE PLpgSQL
CALLED ON NULL INPUT
IMMUTABLE
EXTERNAL SECURITY INVOKER;
Can you help please?CoreLab.PostgreSql.PgSqlException was unhandled by user code
Message="cannot insert multiple commands into a prepared statement"
Source="CoreLab.PostgreSql"
ErrorCode=-2147467259
CallStack=""
DetailMessage=""
FileName="postgres.c"
Hint=""
LineNumber=1125
Position=0
ProcedureName="exec_parse_message"
StackTrace:
at CoreLab.Common.DbScript.ExecuteNext(IDataReader& reader)
at CoreLab.Common.DbScript.Execute()
at co2005_to_2007_pgsql.frmMain.btStart_Click(Object sender, EventArgs e) in E:\vs2005\source\co2005_to_2007_pgsql\co2005_to_2007_pgsql\frmMain.cs:line 417
at System.Windows.Forms.Control.OnClick(EventArgs e)
.....
Kind Regards,
Hedley Muscroft