[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
sql/Pg-database.sql FUNCTION person__get_my_entity_id()
- Subject: sql/Pg-database.sql FUNCTION person__get_my_entity_id()
- From: herman vierendeels <..hidden..>
- Date: Thu, 31 Oct 2013 20:43:29 +0100
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