Skip to content

Instantly share code, notes, and snippets.

View olirice's full-sized avatar

Oliver Rice olirice

  • USA
View GitHub Profile
@olirice
olirice / generic_audit_trigger.sql
Created February 3, 2022 20:19
Generic Audit Trigger With Linear Time Record History Search
/*
Generic Audit Trigger
Linear Time Record Version History
Date:
2022-02-03
Purpose:
Generic audit history for tables including an indentifier
to enable indexed linear time lookup of a primary key's version history
@olirice
olirice / seq_guid_id.sql
Created February 19, 2021 18:19
Postgres Sequential Globally Unique Ids
-- Available on RDS and Google Cloud SQL
create extension if not exists "uuid-ossp";
-- A shared numeric sequence to prepend to the UUID
create sequence if not exists global_seq_id;
create function next_guid() returns uuid as
$$
select (
to_char(nextval('global_seq_id'), 'fm0000000000')