Sfoglia il codice sorgente

create trigger function when creating category tables

Pi 1 anno fa
parent
commit
c3c19145b3
1 ha cambiato i file con 16 aggiunte e 0 eliminazioni
  1. 16 0
      create-categories.sql

+ 16 - 0
create-categories.sql

@@ -1,3 +1,19 @@
+--
+-- Name: normalize_on_insert(); Type: FUNCTION; Schema: public; Owner: pgdb
+--
+
+CREATE OR REPLACE FUNCTION public.normalize_on_insert() RETURNS trigger
+    LANGUAGE plpgsql
+    AS $$
+    BEGIN        
+        NEW.reference = normalizeverse(NEW.reference);
+        RETURN NEW;
+    END;
+$$;
+
+
+ALTER FUNCTION public.normalize_on_insert() OWNER TO pgdb;
+
 --
 -- Name: reference; Type: TABLE; Schema: public; Owner: pgdb
 --