I have developed many systems which used PostgreSQL as database. I have 11 years of experience in PHP and PostgreSQL was my primary database system. I can write trigger functions, stored functions, materialized views with window functions and aggregates including synchronization with other systems (using plpython3u for example). You can leverage my experience in order to receive answers to your questions.
Please contact me to discuss the details and get the answers.