SETY
08/15/2021, 2:24 PMburggraf
08/15/2021, 10:07 PMSETY
08/28/2021, 2:13 PMSETY
08/28/2021, 2:51 PMburggraf
08/28/2021, 5:55 PMburggraf
08/28/2021, 5:56 PMburggraf
08/28/2021, 6:06 PMburggraf
08/28/2021, 6:10 PMburggraf
08/28/2021, 6:11 PMSETY
08/28/2021, 11:11 PMSETY
08/28/2021, 11:11 PMdrop table if exists user_roles;
drop type if exists custom_user_roles;
CREATE TYPE custom_user_roles AS ENUM ('user','approver','admin');
create table user_roles (
id uuid references auth.users not null unique,
role custom_user_roles not null default 'user',
primary key (id)
);
alter table user_roles enable row level security;
create or replace function add_default_user()
returns trigger as
$$
begin
insert into public.user_roles(id, role) VALUES (NEW.id, 'user');
return NEW;
end;
$$
language 'plpgsql' SECURITY DEFINER;
drop trigger if exists default_user_role on auth.users;
create trigger default_user_role after insert on auth.users execute procedure add_default_user();
SETY
08/28/2021, 11:11 PMSETY
08/28/2021, 11:11 PMSETY
08/28/2021, 11:12 PMSETY
08/28/2021, 11:12 PMburggraf
08/28/2021, 11:13 PMSETY
08/28/2021, 11:14 PMSETY
08/28/2021, 11:14 PMburggraf
08/28/2021, 11:14 PMburggraf
08/28/2021, 11:14 PMSETY
08/28/2021, 11:14 PMCREATE EXTENSION IF NOT EXISTS file_fdw;
CREATE SERVER IF NOT EXISTS logserver FOREIGN DATA WRAPPER file_fdw;
CREATE FOREIGN TABLE IF NOT EXISTS postgres_log_text (log_entry text)
SERVER logserver OPTIONS (program 'tac pg_log/postgresql.csv', format 'text');
--
-- read the most recent 20 entries from the log file
--
SELECT log_entry from postgres_log_text LIMIT 20;
burggraf
08/28/2021, 11:14 PMSETY
08/28/2021, 11:15 PMburggraf
08/28/2021, 11:15 PMSETY
08/28/2021, 11:15 PMburggraf
08/28/2021, 11:15 PMSELECT log_entry from postgres_log_text LIMIT 20;
burggraf
08/28/2021, 11:15 PMSETY
08/28/2021, 11:15 PMSETY
08/28/2021, 11:15 PMSETY
08/28/2021, 11:16 PMburggraf
08/28/2021, 11:16 PMburggraf
08/28/2021, 11:16 PMSETY
08/28/2021, 11:16 PMSETY
08/28/2021, 11:16 PMSETY
08/28/2021, 11:16 PMburggraf
08/28/2021, 11:17 PMburggraf
08/28/2021, 11:17 PMburggraf
08/28/2021, 11:17 PMburggraf
08/28/2021, 11:17 PMburggraf
08/28/2021, 11:18 PMburggraf
08/28/2021, 11:18 PMSETY
08/28/2021, 11:18 PMSETY
08/28/2021, 11:18 PMSETY
08/28/2021, 11:19 PMSETY
08/28/2021, 11:19 PMburggraf
08/28/2021, 11:19 PMburggraf
08/28/2021, 11:19 PMburggraf
08/28/2021, 11:19 PM