Page 1 of 1

Error when executing parametrized SET statement in postgresq

Posted: 26.08.2014, 14:42
by pijaffka
Hello

I found problem ZEOSDBO-7.1.3a-stable when trying to run such code:

Code: Select all

      v_query.SQL.Text:= 'SET application_name = :app_name; ';
      v_query.ParamByName('app_name').AsString:= 'some_app_name';
      v_query.ExecSQL;
I got exception
ERROR: syntax error at or near "$1" LINE 1: SET application_name = $1;

It looks like zeos try to call prepare on "SET application_name = :app_name;' statement, but postgresql can accept only SELECT, UPDATE, INSERT, DELETE statements;

Executing
SET application_name = 'other_app_name' ;
works fine, problem occurs when i use params.

Re: Error when executing parametrized SET statement in postg

Posted: 07.09.2014, 11:14
by EgonHugeist
Hi,
yes this is true (iven if i would agree to write such code!).

Workaround:

add 'EMULATE_PREPARES=True' to the TZDataSet.Properties. This suppressess ALL prepareable stmts too.