diff --git a/.tmux.md.swp b/.tmux.md.swp deleted file mode 100644 index 57d60d9..0000000 Binary files a/.tmux.md.swp and /dev/null differ diff --git a/cms.md b/cms.md new file mode 100644 index 0000000..d90f1d4 --- /dev/null +++ b/cms.md @@ -0,0 +1,5 @@ +PDMN24-1 Maintain Product Structure +IVMN02-4 Maint Part/Plant +IVMN14-7 Costing Sheet +PDMN31-1 WO Production Reporting +PDMN06 Maintain WO \ No newline at end of file diff --git a/install_list.md b/install_list.md new file mode 100644 index 0000000..b67b3af --- /dev/null +++ b/install_list.md @@ -0,0 +1,18 @@ +dbeaver +vs code +bash +vundle + +npgsql +pspg +postgresql apt repo +pgadmin +windows postgres + +nodejs + + +power bi +ms data gateway +excel add-in + diff --git a/postgres/user.sql b/postgres/user.sql index b3ee013..30124c6 100644 --- a/postgres/user.sql +++ b/postgres/user.sql @@ -1,8 +1,8 @@ -DROP USER IF EXISTS api; +DROP USER IF EXISTS report; -SET password_encryption = 'md5' /* ='scram' */; +SET password_encryption = 'scram-sha-256'; -CREATE ROLE api WITH +CREATE ROLE report WITH LOGIN NOSUPERUSER NOCREATEDB @@ -10,30 +10,30 @@ CREATE ROLE api WITH INHERIT NOREPLICATION CONNECTION LIMIT -1 - PASSWORD ''; + PASSWORD 'report'; --------------------grant-------------------------------------------------- -GRANT USAGE ON SCHEMA tps TO api; +GRANT USAGE ON SCHEMA lgdat TO report; -GRANT SELECT/*, UPDATE, INSERT, DELETE*/ ON ALL TABLES IN SCHEMA tps TO api; +GRANT SELECT /*, UPDATE, INSERT, DELETE*/ ON ALL TABLES IN SCHEMA lgdat TO report; -GRANT USAGE ON ALL SEQUENCES IN SCHEMA tps TO api; +GRANT USAGE ON ALL SEQUENCES IN SCHEMA lgdat TO report; -ALTER DEFAULT PRIVILEGES IN SCHEMA tps GRANT SELECT/*, UPDATE, INSERT, DELETE*/ ON TABLES TO api; +ALTER DEFAULT PRIVILEGES IN SCHEMA lgdat GRANT SELECT/*, UPDATE, INSERT, DELETE*/ ON TABLES TO report; -ALTER DEFAULT PRIVILEGES IN SCHEMA tps GRANT USAGE ON SEQUENCES TO api; +ALTER DEFAULT PRIVILEGES IN SCHEMA lgdat GRANT USAGE ON SEQUENCES TO report; ---------------------------revoke--------------------------------------- -REVOKE USAGE ON SCHEMA tps FROM api; +REVOKE USAGE ON SCHEMA lgdat FROM report; -REVOKE USAGE ON SCHEMA tps FROM api; +REVOKE USAGE ON SCHEMA lgdat FROM report; -REVOKE SELECT , UPDATE, INSERT, DELETE ON ALL TABLES IN SCHEMA tps FROM api; +REVOKE SELECT , UPDATE, INSERT, DELETE ON ALL TABLES IN SCHEMA lgdat FROM report; -REVOKE USAGE ON ALL SEQUENCES IN SCHEMA tps FROM api; +REVOKE USAGE ON ALL SEQUENCES IN SCHEMA lgdat FROM report; -ALTER DEFAULT PRIVILEGES IN SCHEMA tps REVOKE SELECT, UPDATE, INSERT, DELETE ON TABLES FROM api; +ALTER DEFAULT PRIVILEGES IN SCHEMA lgdat REVOKE SELECT, UPDATE, INSERT, DELETE ON TABLES FROM report; -ALTER DEFAULT PRIVILEGES IN SCHEMA tps REVOKE USAGE ON SEQUENCES FROM api; \ No newline at end of file +ALTER DEFAULT PRIVILEGES IN SCHEMA lgdat REVOKE USAGE ON SEQUENCES FROM report; diff --git a/sql_server/error_handling.sql b/sql_server/error_handling.sql new file mode 100644 index 0000000..778cae4 --- /dev/null +++ b/sql_server/error_handling.sql @@ -0,0 +1,33 @@ +CREATE PROC RLARP.TEST AS + +BEGIN + PRINT 'Hi'; --non-erroring statement + create table #temp(x varchar(255)); --create a permanent object to call outside block after error + insert into #temp select 1/0; + insert into #temp select 'hi'; --fill it after error + --select * from #temp; --select it after error + PRINT ERROR_MESSAGE(); --error message is gone + +END; + +begin transaction x +declare @e int; +DECLARE @em varchar(max); +begin try + EXEC RLARP.TEST; +end TRY +begin CATCH + select @e = ERROR_NUMBER(), @em = ERROR_MESSAGE(); + if @e <> 0 + BEGIN + rollback transaction x; + print @em; + END + if @e = 0 + BEGIN + commit transaction x; + print 'ok'; + end +end catch + +SELECT * FROM #temp \ No newline at end of file