[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

sql/Pg-database.sql FUNCTION person__get_my_entity_id()



Hello,

with more and more triggers in DB,
you hit problems , e.g. with audittrail, when doing
sql-work outside of ledgerSMB, e.g. psql

person__get_my_entity_id() returning empty list

Could we redefine function as to always receive default row?

CREATE OR REPLACE FUNCTION person__get_my_entity_id() RETURNS INT AS
$$
 SELECT entity_id from users where username =  SESSION_USER union
select 1 order by 1 desc limit 1;
$$ LANGUAGE SQL;

Greetings,
Herman Vierendeels