From 2f216d471a8b41eb0d27adfc81d02ec9e43d4bc3 Mon Sep 17 00:00:00 2001 From: nidhibhammar <59045594+nidhibhammar@users.noreply.github.com> Date: Fri, 22 Sep 2023 14:02:49 +0530 Subject: [PATCH] Capitalised the keywords in the code block and formatted the output --- .../pg_extensions/spl_check/index.mdx | 2 + .../pg_extensions/spl_check/using/index.mdx | 56 +++++++++---------- .../spl_check/using/profiler.mdx | 8 +-- 3 files changed, 33 insertions(+), 33 deletions(-) diff --git a/advocacy_docs/pg_extensions/spl_check/index.mdx b/advocacy_docs/pg_extensions/spl_check/index.mdx index d0c91ba5fe8..2617410ea94 100644 --- a/advocacy_docs/pg_extensions/spl_check/index.mdx +++ b/advocacy_docs/pg_extensions/spl_check/index.mdx @@ -1,5 +1,7 @@ --- title: EDB SPL Check +directoryDefaults: + product: EDB SPL Check --- EDB SPL Check is a code analysis tool for SPL on EDB Postgres Advanced Server. Using only the internal PostgreSQL parser, it identifies errors that can occur at runtime. In addition, it parses the SQL inside your routines and identifies errors that are usually missed when executing `CREATE PROCEDURE/FUNCTION/PACKAGE`. Similarly, it identifies errors that are usually missed when executing `CREATE PACKAGE/OBJECT TYPES/COMPOUND TRIGGER`. diff --git a/advocacy_docs/pg_extensions/spl_check/using/index.mdx b/advocacy_docs/pg_extensions/spl_check/using/index.mdx index b8165205733..147ef920369 100644 --- a/advocacy_docs/pg_extensions/spl_check/using/index.mdx +++ b/advocacy_docs/pg_extensions/spl_check/using/index.mdx @@ -15,21 +15,21 @@ CREATE TABLE bar(a int, b int); CREATE OR REPLACE FUNCTION public.foo(); \sf+ foo_trg - CREATE OR REPLACE FUNCTION public.foo_trg() - RETURNS trigger - LANGUAGE edbspl -1 AS $function$ -2 BEGIN -3 NEW.c := NEW.a + NEW.b; -4 RETURN NEW; -5 END; -6 $function$ +CREATE OR REPLACE FUNCTION public.foo_trg() + RETURNS trigger + LANGUAGE edbspl + AS $function$ + BEGIN + NEW.c := NEW.a + NEW.b; + RETURN NEW; + END; +$function$ ``` When there's no specified relation for the trigger, the following is returned: ```sql -select * from spl_check_function('foo_trg()'); +SELECT * FROM spl_check_function('foo_trg()'); __OUTPUT__ ERROR: missing trigger relation HINT: Trigger relation oid must be valid @@ -38,7 +38,7 @@ HINT: Trigger relation oid must be valid When the trigger is checked successfully with a specified relation, the following is returned: ```sql -select * from spl_check_function('foo_trg()', 'bar'); +SELECT * FROM spl_check_function('foo_trg()', 'bar'); __OUTPUT__ spl_check_function -------------------------------------------------------- @@ -49,22 +49,22 @@ __OUTPUT__ For triggers with transitive tables, set the `oldtable` and `newtable` parameters: ```sql -create or replace function footab_trig_func() -returns trigger as $$ -declare x int; -begin - if false then +CREATE OR REPLACE FUNCTION footab_trig_func() +RETURNS trigger as $$ +DECLARE x int; +BEGIN + IF false THEN -- should be ok; - select count(*) from newtab into x; + SELECT COUNT(*) FROM newtab INTO x; -- should fail; - select count(*) from newtab where d = 10 into x; - end if; - return null; -end; -$$ language edbspl; + SELECT COUNT(*) FROM newtab WHERE d = 10 into x; + END If; + RETURN null; +END; +$$ LANGUAGE edbspl; -select * from spl_check_function('footab_trig_func','footab', newtable := 'newtab'); +SELECT * FROM spl_check_function('footab_trig_func','footab', newtable := 'newtab'); ``` ## Validating compound triggers @@ -72,12 +72,12 @@ select * from spl_check_function('footab_trig_func','footab', newtable := 'newta Another way to verify a trigger function is to use `spl_check_trigger()` by providing the trigger name and, optionally, the relation name. This method is useful for redwood-style triggers and compound triggers where trigger functions are created internally. For example: ```sql -create table tab(a int); -create or replace trigger tg1 before insert on tab -for each row -begin +CREATE TABLE tab(a int); +CREATE or REPLACE trigger tg1 before insert on tab +FOR EACH ROW +BEGIN NEW.a := NEW.b; -end; +END; select * from spl_check_trigger('tg1'); __OUTPUT__ diff --git a/advocacy_docs/pg_extensions/spl_check/using/profiler.mdx b/advocacy_docs/pg_extensions/spl_check/using/profiler.mdx index c83c305382a..668cbb343d3 100644 --- a/advocacy_docs/pg_extensions/spl_check/using/profiler.mdx +++ b/advocacy_docs/pg_extensions/spl_check/using/profiler.mdx @@ -11,11 +11,9 @@ Due to dependencies, `shared_preload_libraries` must contain `edb-spl` first: ```sql show shared_preload_libraries ; __OUTPUT__ -┌──────────────────────────┐ -│ shared_preload_libraries │ -╞══════════════════════════╡ -│ edb-spl,spl_check │ -└──────────────────────────┘ + shared_preload_libraries +---------------------------- + edb-spl,spl_check (1 row) ```