sp_upsert_guest_history


Description

Hot-path writer for public.guest_history — reads public.* ONLY, never backup.* (a registration still present in public.registration always has its folio, transactions, rates and requests in public too: sp_endday_clear_data archives a registration folio together with its registration and its atomic-set guard drops any registration whose transactions reference outside the batch). Returns > 0 when a stay row was written, < 0 when one was removed because the registration is no longer checked out (cancel-checkout), 0 when nothing to do. Write-once: an existing row is never overwritten — the deliberate repair path is sp_rebuild_guest_history(i_force := true).

Parameters

Name Type Mode
i_register_id integer IN

Definition