--
-- PostgreSQL database dump
--

SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = off;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET escape_string_warning = off;

--
-- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: -; Owner: -
--

CREATE PROCEDURAL LANGUAGE plpgsql;


SET search_path = public, pg_catalog;

--
-- Name: accreq_attr_update_ref(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION accreq_attr_update_ref() RETURNS trigger
    LANGUAGE plpgsql
    AS $$begin

IF (TG_OP != 'INSERT') then
update "accreq" set date = now() where "accreq".ikey = old.okey;
end if;
IF (TG_OP != 'DELETE') then
update "accreq"  set date = now() where "accreq".ikey = new.okey;
end if;

IF (TG_OP = 'DELETE') then
  return old;
ELSE
  return new;
END IF;

END;$$;


--
-- Name: address_attr_update_ref(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION address_attr_update_ref() RETURNS trigger
    LANGUAGE plpgsql
    AS $$begin

IF (TG_OP != 'INSERT') then
update "address" set date = now() where "address".ikey = old.okey;
end if;
IF (TG_OP != 'DELETE') then
update "address"  set date = now() where "address".ikey = new.okey;
end if;

IF (TG_OP = 'DELETE') then
  return old;
ELSE
  return new;
END IF;

END;$$;


--
-- Name: address_sort_fields(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION address_sort_fields() RETURNS trigger
    LANGUAGE plpgsql
    AS $$BEGIN

IF (TG_OP='INSERT') then
IF (new.attr='site') THEN
insert into address_attributes_site VALUES (new.*);
RETURN NULL;
END IF;

IF (new.attr = 'isMainAddress') then
-- remove isMainAddress from other address
-- for of the user
delete from address_attributes_base where
attr = 'isMainAddress' and
okey in (
select addr.ikey from address as addr join
  address on addr.user = address.user
  where 
  address.ikey = new.okey and addr.ikey != new.okey
);
END IF;
end if;

if (TG_OP='DELETE') THEN
RETURN old;
else
RETURN new;
end if;
END;$$;


--
-- Name: address_update_user_rev(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION address_update_user_rev() RETURNS trigger
    LANGUAGE plpgsql
    AS $$begin

IF (TG_OP = 'DELETE') THEN
update "user" set "date" = now() where "name" = old."user";
return old;
ELSE
update "user" set "date" = now() where "name" = new."user";
return new;
end if;

end;$$;


--
-- Name: aliases_nickname(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION aliases_nickname() RETURNS trigger
    LANGUAGE plpgsql
    AS $$begin

IF TG_OP='DELETE' THEN
delete from user_attributes where attr='nickname' and value=old.name;
RETURN old;
END IF;

IF TG_OP='UPDATE' THEN
IF new.forward <> old.forward THEN
delete from user_attributes where attr='nickname' and value=old.name;
RETURN new;
END IF;
END IF;

IF TG_OP='DELETE' then
return old;
ELSE
return new;
END IF;
END;$$;

--
-- Name: department_group_upd_f(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION department_group_upd_f() RETURNS trigger
    LANGUAGE plpgsql
    AS $$BEGIN

IF (new.attr = 'department') then
  BEGIN
  insert into group_attributes (okey, attr, value)
  select "group"."ikey", 'memberUID', "user"."name"
  from "user", "group"
  where "group"."name" = new."value" and "user".ikey = new.okey;
  EXCEPTION WHEN unique_violation THEN
  END;
END IF;

RETURN new;
END;$$;


--
-- Name: fmt_macaddr(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION fmt_macaddr() RETURNS trigger
    LANGUAGE plpgsql
    AS $$begin

new.value := new.value::macaddr::text;

return new;
end;$$;


--
-- Name: group_attr_update_ref(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION group_attr_update_ref() RETURNS trigger
    LANGUAGE plpgsql
    AS $$begin

IF (TG_OP != 'INSERT') then
update "group"  set date = now() where "group"."ikey" = old.okey;
end if;
IF (TG_OP != 'DELETE') then
update "group"  set date = now() where "group"."ikey" = new.okey;
end if;

IF (TG_OP = 'DELETE') then
  return old;
ELSE
  return new;
END IF;

END;$$;


--
-- Name: group_attr_user_update_user_ref(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION group_attr_user_update_user_ref() RETURNS trigger
    LANGUAGE plpgsql
    AS $$begin

IF (TG_OP != 'INSERT') then
update "user"  set date = now() where "user"."name" = old.value;
end if;
IF (TG_OP != 'DELETE') then
update "user"  set date = now() where "user"."name" = new.value;
end if;

IF (TG_OP = 'DELETE') then
  return old;
ELSE
  return new;
END IF;

END;$$;


--
-- Name: group_sort_fields(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION group_sort_fields() RETURNS trigger
    LANGUAGE plpgsql
    AS $$BEGIN

IF (TG_OP='INSERT') then
IF (new.attr='managedBy'
OR  new.attr='member'
OR  new.attr='memberUID') THEN
insert into group_attributes_users VALUES (new.*);
RETURN NULL;
END IF;

IF (new.attr='sutype') THEN
insert into group_attributes_sutypes VALUES (new.*);
RETURN NULL;
END IF;
end if;


IF (TG_OP = 'UPDATE') THEN
IF (new.attr='gidNumber') then
update "group" set gidnumber = new.value::integer where "group".ikey = new.okey;
RETURN NULL;
END IF;
END IF;

IF (TG_OP = 'DELETE') THEN
IF (old.attr='exported') then
update "group" set exported = false where "group".ikey = old.okey;
return null;
end if;
else
IF (new.attr='exported') then
update "group" set exported = true where "group".ikey = new.okey;
RETURN NULL;
end if;
END IF;

if (TG_OP='DELETE') THEN
RETURN old;
else
RETURN new;
end if;
END;$$;


--
-- Name: nethost_attr_update_ref(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION nethost_attr_update_ref() RETURNS trigger
    LANGUAGE plpgsql
    AS $$begin

IF (TG_OP != 'INSERT') then
update "nethost" set date = now() where "nethost".ikey = old.okey;
end if;
IF (TG_OP != 'DELETE') then
update "nethost"  set date = now() where "nethost".ikey = new.okey;
end if;

IF (TG_OP = 'DELETE') then
  return old;
ELSE
  return new;
END IF;

END;$$;


--
-- Name: nethost_sort_fields(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION nethost_sort_fields() RETURNS trigger
    LANGUAGE plpgsql
    AS $$BEGIN

IF (TG_OP='INSERT') then
IF (new.attr='ip') THEN
insert into nethost_attributes_ips VALUES (new.*);
RETURN NULL;
END IF;

IF (new.attr='macaddr') THEN
insert into nethost_attributes_macs VALUES (new.*);
RETURN NULL;
END IF;

IF (new.attr='owner') THEN
insert into nethost_attributes_users VALUES (new.*);
RETURN NULL;
END IF;
end if;



if (TG_OP='DELETE') THEN
RETURN old;
else
RETURN new;
end if;
END;$$;


--
-- Name: nethost_upd_zone(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION nethost_upd_zone() RETURNS trigger
    LANGUAGE plpgsql
    AS $$begin

  IF (TG_OP = 'DELETE') THEN
    update netzone set date=now() where ikey in
    (
    select okey from netzone_attributes where attr='allow_dyn'
    union
    select netzone_attributes.okey from netzone_attributes join
    nethost_attributes_ips on netzone_attributes.attr='net' and 
    nethost_attributes_ips.value::inet <<= netzone_attributes.value::inet
    where nethost_attributes_ips.okey = old.ikey
    );
  END IF;
  IF (TG_OP = 'INSERT' or TG_OP = 'UPDATE') THEN
    update netzone set date=now() where ikey in
    (
    select okey from netzone_attributes where attr='allow_dyn'
    union
    select netzone_attributes.okey from netzone_attributes join
    nethost_attributes_ips on netzone_attributes.attr='net' and 
    nethost_attributes_ips.value::inet <<= netzone_attributes.value::inet
    where nethost_attributes_ips.okey = new.ikey
    );
  END IF;

 IF (TG_OP = 'DELETE') THEN
   return old;
 ELSE
   return new;
 END IF;

END;$$;


--
-- Name: nethostipdel_upd_zone(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION nethostipdel_upd_zone() RETURNS trigger
    LANGUAGE plpgsql
    AS $$begin


    update netzone set date=now() where ikey in
    (
    select okey from netzone_attributes where attr='allow_dyn'
    union
    select okey from netzone_attributes where attr='net' and
    old.value::inet <<= netzone_attributes.value::inet
    );

   return old;
 
END;$$;


--
-- Name: netzone_attr_update_ref(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION netzone_attr_update_ref() RETURNS trigger
    LANGUAGE plpgsql
    AS $$begin

IF (TG_OP != 'INSERT') then
update "netzone" set date = now() where "netzone".ikey = old.okey;
end if;
IF (TG_OP != 'DELETE') then
update "netzone"  set date = now() where "netzone".ikey = new.okey;
end if;

IF (TG_OP = 'DELETE') then
  return old;
ELSE
  return new;
END IF;

END;$$;


--
-- Name: netzone_sort_fields(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION netzone_sort_fields() RETURNS trigger
    LANGUAGE plpgsql
    AS $$BEGIN

IF (TG_OP='INSERT') then
IF (new.attr='site') THEN
insert into netzone_attributes_site VALUES (new.*);
RETURN NULL;
END IF;

IF (new.attr='dynFrom') THEN
insert into netzone_attributes_netzone VALUES (new.*);
RETURN NULL;
END IF;

end if;

if (TG_OP='DELETE') THEN
RETURN old;
else
RETURN new;
end if;
END;$$;


--
-- Name: person_attr_update_ref(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION person_attr_update_ref() RETURNS trigger
    LANGUAGE plpgsql
    AS $$begin

IF (TG_OP != 'INSERT') then
update "user" set date = now() where "user".ikey = old.okey;
update "group" set date = now() where "group".name = old.value;
end if;
IF (TG_OP != 'DELETE') then
update "user"  set date = now() where "user".ikey = new.okey;
update "group" set date = now() where "group".name = new.value;
end if;

IF (TG_OP = 'DELETE') then
  return old;
ELSE
  return new;
END IF;

END;$$;


--
-- Name: rev_tg_f(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION rev_tg_f() RETURNS trigger
    LANGUAGE plpgsql
    AS $$begin

IF (TG_OP = 'DELETE') THEN
  update settings set val = old.ikey where varname = 'last-delete';
  IF NOT FOUND THEN
    insert into settings (varname, val) values ('last-delete', old.ikey);
  END IF;
  return old;
else
  IF (TG_OP = 'INSERT') THEN
  new.rev := nextval('revisions_rev_seq'::regclass);
  new.date := now();
  ELSIF (old.rev = new.rev) THEN
  new.rev := nextval('revisions_rev_seq'::regclass);
  new.date := now();
  END IF;  
  return new;
END IF;

end;$$;


--
-- Name: site_attr_update_ref(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION site_attr_update_ref() RETURNS trigger
    LANGUAGE plpgsql
    AS $$begin

IF (TG_OP != 'INSERT') then
update "site" set date = now() where "site".ikey = old.okey;
end if;
IF (TG_OP != 'DELETE') then
update "site"  set date = now() where "site".ikey = new.okey;
end if;

IF (TG_OP = 'DELETE') then
  return old;
ELSE
  return new;
END IF;

END;$$;


--
-- Name: update_address_site(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION update_address_site() RETURNS trigger
    LANGUAGE plpgsql
    AS $$begin

IF (TG_OP='DELETE') then
update address set date = now() where ikey in
(select okey from address_attributes where attr = 'site' and
value = old.name);
return old;
ELSE
update address set date = now() where ikey in
(select okey from address_attributes where attr = 'site' and
value = new.name);
return new;
end if;

end;$$;


--
-- Name: user_sort_fields(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION user_sort_fields() RETURNS trigger
    LANGUAGE plpgsql
    AS $$DECLARE
  rec RECORD;
BEGIN

IF (TG_OP='UPDATE' or TG_OP='INSERT') THEN

IF (new.attr='locked') THEN
  IF (TG_OP = 'INSERT') THEN
    new.value = now()::text;
  ELSIF (TG_OP='UPDATE') THEN
    new.value = old.value;
  END IF;
END IF;

IF (new.attr='nickname') THEN
  PERFORM 1 from "user" where "user".ikey = new.okey
  and new.value = "user".name;
  IF NOT FOUND THEN
    select aliases.name into rec from aliases join "user"
    on array["user".name] = aliases.forward
    where "user".ikey = new.okey and aliases.name = new.value;
    IF NOT FOUND THEN
      insert into aliases ("name", "forward")
      select new.value, array["user".name] from "user" where "user".ikey = new.okey;
    END IF;
  END IF;
END IF;

IF (new.attr='uidNumber') THEN
update "user" set uidnumber = new.value::integer where ikey = new.okey;
RETURN NULL;
END IF;

IF (new.attr='gidNumber') THEN
update "user" set gidnumber = new.value::integer where ikey = new.okey;
RETURN null;
END IF;

IF (new.attr='expire') THEN
update "user" set expire = new.value::timestamp where ikey = new.okey;
RETURN NULL;
END IF;

IF (new.attr='exported') THEN
update "user" set exported = true where ikey = new.okey;
RETURN NULL;
END IF;

END IF;

IF (TG_OP = 'DELETE') THEN

IF (old.attr='expire') THEN
update "user" set expire = NULL where ikey = old.okey;
RETURN NULL;
END IF;

IF (old.attr='exported') THEN
update "user" set exported = false where ikey = old.okey;
RETURN NULL;
END IF;

END IF;


IF (TG_OP='INSERT') THEN
IF (new.attr='manager') THEN
insert into user_attributes_users VALUES (new.*);
RETURN NULL;
END IF;

IF (new.attr='site') THEN
insert into user_attributes_site VALUES (new.*);
RETURN NULL;
END IF;

IF (new.attr='department') THEN
insert into user_attributes_groups VALUES (new.*);
RETURN NULL;
END IF;

IF (new.attr='contratType') THEN
insert into user_attributes_groups VALUES (new.*);
RETURN NULL;
END IF;

IF (new.attr='jobType') THEN
insert into user_attributes_groups VALUES (new.*);
RETURN NULL;
END IF;

END IF;

IF (TG_OP='DELETE') then
RETURN old;
ELSE
RETURN new;
end if;
END;$$;


--
-- Name: ikey_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE ikey_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


SET default_tablespace = '';

SET default_with_oids = false;

--
-- Name: revisions; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE revisions (
    rev integer NOT NULL,
    date timestamp with time zone DEFAULT now() NOT NULL,
    "create" timestamp with time zone DEFAULT now() NOT NULL,
    ikey integer DEFAULT nextval('ikey_seq'::regclass) NOT NULL
);


--
-- Name: revisions_rev_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE revisions_rev_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


--
-- Name: revisions_rev_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE revisions_rev_seq OWNED BY revisions.rev;


--
-- Name: objects; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE objects (
    exported boolean DEFAULT true NOT NULL,
    name text NOT NULL
)
INHERITS (revisions);


--
-- Name: accreq; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE accreq (
)
INHERITS (objects);


--
-- Name: attributes; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE attributes (
    value text NOT NULL,
    attr_key integer NOT NULL,
    okey integer NOT NULL,
    attr text NOT NULL
);


--
-- Name: attributes_attr_key_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE attributes_attr_key_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


--
-- Name: attributes_attr_key_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE attributes_attr_key_seq OWNED BY attributes.attr_key;


--
-- Name: accreq_attributes; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE accreq_attributes (
)
INHERITS (attributes);


--
-- Name: attributes_list; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE attributes_list (
    canonical text NOT NULL,
    ikey integer DEFAULT nextval('ikey_seq'::regclass) NOT NULL,
    description text
);


--
-- Name: COLUMN attributes_list.canonical; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN attributes_list.canonical IS 'Nom de l''attribut';


--
-- Name: COLUMN attributes_list.ikey; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN attributes_list.ikey IS 'Clef interne à la base';


--
-- Name: accreq_attributes_list; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE accreq_attributes_list (
    ikey integer,
    rev integer DEFAULT nextval('revisions_rev_seq'::regclass) NOT NULL,
    date timestamp with time zone DEFAULT now() NOT NULL,
    "create" timestamp with time zone DEFAULT now() NOT NULL
)
INHERITS (attributes_list);


--
-- Name: address_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE address_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


--
-- Name: address; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE address (
    name text DEFAULT ('address'::text || (nextval('address_seq'::regclass))::text),
    "user" text NOT NULL
)
INHERITS (objects);


--
-- Name: address_attributes_base; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE address_attributes_base (
)
INHERITS (attributes);


--
-- Name: address_attributes; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW address_attributes AS
    (SELECT address."user" AS value, 'user' AS attr, address.rev AS attr_key, address.ikey AS okey FROM address UNION ALL SELECT address.name AS value, 'name' AS attr, address.rev AS attr_key, address.ikey AS okey FROM address) UNION ALL SELECT address_attributes.value, address_attributes.attr, address_attributes.attr_key, address_attributes.okey FROM address_attributes_base address_attributes;


--
-- Name: address_attributes_list; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE address_attributes_list (
    rev integer,
    date timestamp with time zone,
    "create" timestamp with time zone
)
INHERITS (attributes_list, revisions);


--
-- Name: address_attributes_list_site; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE address_attributes_list_site (
)
INHERITS (address_attributes_list);


--
-- Name: address_attributes_site; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE address_attributes_site (
)
INHERITS (address_attributes_base);


--
-- Name: aliases; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE aliases (
    forward text[],
    expire timestamp with time zone
)
INHERITS (objects);


--
-- Name: TABLE aliases; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON TABLE aliases IS 'Mail aliases';


--
-- Name: user; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE "user" (
    name text,
    uidnumber integer NOT NULL,
    gidnumber integer NOT NULL,
    expire timestamp with time zone,
    CONSTRAINT uid_not_empty CHECK ((name <> ''::text))
)
INHERITS (objects);


--
-- Name: aliases_attributes; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW aliases_attributes AS
    SELECT "user".name AS value, 'user'::text AS attr, aliases.rev AS attr_key, aliases.ikey AS okey FROM (aliases JOIN "user" ON (((aliases.name = "user".name) OR (aliases.forward = ARRAY["user".name]))));


--
-- Name: aliases_attributes_list; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE aliases_attributes_list (
    ikey integer,
    canonical text,
    description text
)
INHERITS (revisions, attributes_list);


--
-- Name: all_obj_attributes; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW all_obj_attributes AS
    SELECT pg_class.relname, objects.name, attributes_list.description, attributes.attr_key, attributes.attr, attributes.value FROM (((attributes_list JOIN attributes ON ((attributes.attr = attributes_list.canonical))) JOIN pg_class ON ((attributes.tableoid = pg_class.oid))) JOIN objects ON ((objects.ikey = attributes.okey)));


--
-- Name: group; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE "group" (
    name text,
    gidnumber integer NOT NULL,
    CONSTRAINT group_name_not_empty CHECK ((name <> ''::text))
)
INHERITS (objects);


--
-- Name: group_attributes_base; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE group_attributes_base (
)
INHERITS (attributes);


--
-- Name: user_attributes_base; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE user_attributes_base (
)
INHERITS (attributes);


--
-- Name: group_attributes; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW group_attributes AS
    (((SELECT ("group".gidnumber)::text AS value, 'gidnumber' AS attr, "group".rev AS attr_key, "group".ikey AS okey FROM "group" UNION ALL SELECT "group".name AS value, 'name' AS attr, "group".rev AS attr_key, "group".ikey AS okey FROM "group") UNION ALL SELECT '1'::text AS value, 'exported' AS attr, "group".rev AS attr_key, "group".ikey AS okey FROM "group" WHERE ("group".exported = true)) UNION ALL SELECT group_attributes.value, group_attributes.attr, group_attributes.attr_key, group_attributes.okey FROM group_attributes_base group_attributes) UNION ALL SELECT "user".name AS value, 'memberUID' AS attr, user_attributes_base.attr_key, "group".ikey AS okey FROM ((user_attributes_base JOIN "user" ON (("user".ikey = user_attributes_base.okey))) JOIN "group" ON (("group".name = user_attributes_base.value))) WHERE (user_attributes_base.attr = 'contratType'::text);


--
-- Name: group_attributes_list; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE group_attributes_list (
)
INHERITS (revisions, attributes_list);


--
-- Name: group_attributes_sutypes; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE group_attributes_sutypes (
)
INHERITS (group_attributes_base);


--
-- Name: group_attributes_users; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE group_attributes_users (
)
INHERITS (group_attributes_base);


--
-- Name: nethost; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE nethost (
)
INHERITS (objects);


--
-- Name: nethost_attributes; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE nethost_attributes (
)
INHERITS (attributes);


--
-- Name: nethost_attributes_ips; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE nethost_attributes_ips (
)
INHERITS (nethost_attributes);


--
-- Name: nethost_attributes_list; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE nethost_attributes_list (
    ikey integer,
    canonical text,
    description text
)
INHERITS (revisions, attributes_list);


--
-- Name: nethost_attributes_macs; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE nethost_attributes_macs (CONSTRAINT nethost_valid_mac_address CHECK (((value)::macaddr <> '00:00:00:00:00:00'::macaddr))
)
INHERITS (nethost_attributes);


--
-- Name: nethost_attributes_users; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE nethost_attributes_users (
)
INHERITS (nethost_attributes);


--
-- Name: netzone; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE netzone (
)
INHERITS (objects);


--
-- Name: netzone_attributes; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE netzone_attributes (
)
INHERITS (attributes);


--
-- Name: netzone_attributes_list; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE netzone_attributes_list (
    ikey integer,
    canonical text,
    description text
)
INHERITS (revisions, attributes_list);


--
-- Name: netzone_attributes_netzone; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE netzone_attributes_netzone (
)
INHERITS (netzone_attributes);


--
-- Name: netzone_attributes_site; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE netzone_attributes_site (
)
INHERITS (netzone_attributes);


--
-- Name: objects_table; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW objects_table AS
    SELECT objects.rev, objects.date, objects."create", objects.ikey, pg_class.relname, objects.name, objects.exported FROM (objects JOIN pg_class ON ((objects.tableoid = pg_class.oid)));


--
-- Name: revaliases; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE revaliases (
    "as" text NOT NULL
)
INHERITS (objects);


--
-- Name: revisions_table; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW revisions_table AS
    SELECT revisions.rev, revisions.date, revisions."create", revisions.ikey, pg_class.relname FROM (revisions JOIN pg_class ON ((revisions.tableoid = pg_class.oid)));


--
-- Name: settings; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE settings (
    varname text NOT NULL,
    val text
)
INHERITS (revisions);


--
-- Name: site; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE site (
    name text
)
INHERITS (objects);


--
-- Name: site_attributes; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE site_attributes (
)
INHERITS (attributes);


--
-- Name: site_attributes_list; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE site_attributes_list (
)
INHERITS (revisions, attributes_list);


--
-- Name: su_type; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE su_type (
    name text,
    description text
)
INHERITS (objects);


--
-- Name: user_attributes; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW user_attributes AS
    (((((((((((SELECT ("user".uidnumber)::text AS value, 'uidnumber' AS attr, "user".rev AS attr_key, "user".ikey AS okey FROM "user" UNION ALL SELECT ("user".gidnumber)::text AS value, 'gidnumber' AS attr, "user".rev AS attr_key, "user".ikey AS okey FROM "user") UNION ALL SELECT "user".name AS value, 'name' AS attr, "user".rev AS attr_key, "user".ikey AS okey FROM "user") UNION ALL SELECT ("user".expire)::text AS value, 'expire' AS attr, "user".rev AS attr_key, "user".ikey AS okey FROM "user" WHERE ("user".expire IS NOT NULL)) UNION ALL SELECT '1'::text AS value, 'exported' AS attr, "user".rev AS attr_key, "user".ikey AS okey FROM "user" WHERE ("user".exported = true)) UNION ALL SELECT address_attributes_site.value, 'allsite' AS attr, "user".rev AS attr_key, "user".ikey AS okey FROM (("user" JOIN address ON ((address."user" = "user".name))) JOIN address_attributes_site ON ((address_attributes_site.okey = address.ikey))) WHERE ((address_attributes_site.attr = 'site'::text) AND (address.exported = true))) UNION ALL SELECT "group".name AS value, 'memberOf' AS attr, "user".rev AS attr_key, "user".ikey AS okey FROM (("user" JOIN group_attributes ON ((group_attributes.value = "user".name))) JOIN "group" ON ((group_attributes.okey = "group".ikey))) WHERE (group_attributes.attr = 'memberUID'::text)) UNION ALL SELECT user_attributes.value, user_attributes.attr, user_attributes.attr_key, user_attributes.okey FROM user_attributes_base user_attributes) UNION ALL SELECT "group".name AS value, 'departments' AS attr, "user".rev AS attr_key, "user".ikey AS okey FROM ((("group" JOIN group_attributes_sutypes ON (("group".ikey = group_attributes_sutypes.okey))) JOIN group_attributes_users ON ((("group".ikey = group_attributes_users.okey) AND (group_attributes_users.attr = 'memberUID'::text)))) JOIN "user" ON (("user".name = group_attributes_users.value))) WHERE ((group_attributes_sutypes.value = 'dpmt'::text) AND (group_attributes_sutypes.attr = 'sutype'::text))) UNION ALL SELECT "group".name AS value, 'cells' AS attr, "user".rev AS attr_key, "user".ikey AS okey FROM ((("group" JOIN group_attributes_sutypes ON (("group".ikey = group_attributes_sutypes.okey))) JOIN group_attributes_users ON ((("group".ikey = group_attributes_users.okey) AND (group_attributes_users.attr = 'memberUID'::text)))) JOIN "user" ON (("user".name = group_attributes_users.value))) WHERE ((group_attributes_sutypes.value = 'cell'::text) AND (group_attributes_sutypes.attr = 'sutype'::text))) UNION ALL SELECT "group".name AS value, 'managedObjects' AS attr, "user".rev AS attr_key, "user".ikey AS okey FROM (("user" JOIN group_attributes ON ((group_attributes.value = "user".name))) JOIN "group" ON ((group_attributes.okey = "group".ikey))) WHERE (group_attributes.attr = 'managedBy'::text)) UNION ALL SELECT (justify_interval((now() - "user".expire)))::text AS value, 'expired' AS attr, "user".rev AS attr_key, "user".ikey AS okey FROM "user" WHERE ("user".expire <= now())) UNION ALL SELECT (1)::text AS value, 'active' AS attr, "user".rev AS attr_key, "user".ikey AS okey FROM "user" WHERE ((("user".expire IS NULL) OR ("user".expire >= now())) AND ("user".exported = true));


--
-- Name: user_attributes_groups; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE user_attributes_groups (
)
INHERITS (user_attributes_base);


--
-- Name: user_attributes_list; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE user_attributes_list (
)
INHERITS (revisions, attributes_list);


--
-- Name: user_attributes_site; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE user_attributes_site (
)
INHERITS (user_attributes_base);


--
-- Name: user_attributes_users; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE user_attributes_users (
)
INHERITS (user_attributes_base);


--
-- Name: attr_key; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE address_attributes ALTER COLUMN attr_key SET DEFAULT nextval('attributes_attr_key_seq'::regclass);


--
-- Name: attr_key; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE attributes ALTER COLUMN attr_key SET DEFAULT nextval('attributes_attr_key_seq'::regclass);


--
-- Name: attr_key; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE group_attributes ALTER COLUMN attr_key SET DEFAULT nextval('attributes_attr_key_seq'::regclass);


--
-- Name: rev; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE revisions ALTER COLUMN rev SET DEFAULT nextval('revisions_rev_seq'::regclass);


--
-- Name: attr_key; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE user_attributes ALTER COLUMN attr_key SET DEFAULT nextval('attributes_attr_key_seq'::regclass);


--
-- Name: acccreq_attributes_list_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY accreq_attributes_list
    ADD CONSTRAINT acccreq_attributes_list_pkey PRIMARY KEY (canonical);


--
-- Name: accreq_attributes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY accreq_attributes
    ADD CONSTRAINT accreq_attributes_pkey PRIMARY KEY (attr_key);


--
-- Name: accreq_ikey_uniq; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY accreq
    ADD CONSTRAINT accreq_ikey_uniq UNIQUE (ikey);


--
-- Name: accreq_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY accreq
    ADD CONSTRAINT accreq_pkey PRIMARY KEY (name);


--
-- Name: address_attr_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY address_attributes_base
    ADD CONSTRAINT address_attr_pkey PRIMARY KEY (attr_key);


--
-- Name: address_attr_site_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY address_attributes_site
    ADD CONSTRAINT address_attr_site_pkey PRIMARY KEY (attr_key);


--
-- Name: address_attributes_list_c_uniq; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY address_attributes_list
    ADD CONSTRAINT address_attributes_list_c_uniq UNIQUE (canonical);


--
-- Name: address_attributes_list_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY address_attributes_list
    ADD CONSTRAINT address_attributes_list_pkey PRIMARY KEY (ikey);


--
-- Name: address_attributes_list_site_c_uniq; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY address_attributes_list_site
    ADD CONSTRAINT address_attributes_list_site_c_uniq UNIQUE (canonical);


--
-- Name: address_attributes_list_site_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY address_attributes_list_site
    ADD CONSTRAINT address_attributes_list_site_pkey PRIMARY KEY (ikey);


--
-- Name: address_ikey_uniq; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY address
    ADD CONSTRAINT address_ikey_uniq UNIQUE (ikey);


--
-- Name: address_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY address
    ADD CONSTRAINT address_pkey PRIMARY KEY (name);


--
-- Name: aliases_attributes_list_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY aliases_attributes_list
    ADD CONSTRAINT aliases_attributes_list_pkey PRIMARY KEY (ikey);


--
-- Name: aliases_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY aliases
    ADD CONSTRAINT aliases_pkey PRIMARY KEY (name);


--
-- Name: attributes_list_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY attributes_list
    ADD CONSTRAINT attributes_list_pkey PRIMARY KEY (ikey);


--
-- Name: attributes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY attributes
    ADD CONSTRAINT attributes_pkey PRIMARY KEY (attr_key);


--
-- Name: g_attr_l_aliases_uniq; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY aliases_attributes_list
    ADD CONSTRAINT g_attr_l_aliases_uniq UNIQUE (canonical);


--
-- Name: g_attr_l_c_uniq; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY group_attributes_list
    ADD CONSTRAINT g_attr_l_c_uniq UNIQUE (canonical);


--
-- Name: g_attr_l_nethost_uniq; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY nethost_attributes_list
    ADD CONSTRAINT g_attr_l_nethost_uniq UNIQUE (canonical);


--
-- Name: g_attr_l_netzone_uniq; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY netzone_attributes_list
    ADD CONSTRAINT g_attr_l_netzone_uniq UNIQUE (canonical);


--
-- Name: g_attr_list_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY group_attributes_list
    ADD CONSTRAINT g_attr_list_pkey PRIMARY KEY (ikey);


--
-- Name: goup_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY "group"
    ADD CONSTRAINT goup_pkey PRIMARY KEY (name);


--
-- Name: group_attrbutes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY group_attributes_base
    ADD CONSTRAINT group_attrbutes_pkey PRIMARY KEY (attr_key);


--
-- Name: group_attributes_sutypes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY group_attributes_sutypes
    ADD CONSTRAINT group_attributes_sutypes_pkey PRIMARY KEY (attr_key);


--
-- Name: group_attributes_user_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY group_attributes_users
    ADD CONSTRAINT group_attributes_user_pkey PRIMARY KEY (attr_key);


--
-- Name: group_attributes_users_uniq; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY group_attributes_users
    ADD CONSTRAINT group_attributes_users_uniq UNIQUE (okey, attr, value);


--
-- Name: group_gid_uniq; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY "group"
    ADD CONSTRAINT group_gid_uniq UNIQUE (gidnumber);


--
-- Name: group_ikey_uniq; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY "group"
    ADD CONSTRAINT group_ikey_uniq UNIQUE (ikey);


--
-- Name: nethost_attributes_ip_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY nethost_attributes_ips
    ADD CONSTRAINT nethost_attributes_ip_pkey PRIMARY KEY (attr_key);


--
-- Name: nethost_attributes_list_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY nethost_attributes_list
    ADD CONSTRAINT nethost_attributes_list_pkey PRIMARY KEY (ikey);


--
-- Name: nethost_attributes_mac_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY nethost_attributes_macs
    ADD CONSTRAINT nethost_attributes_mac_pkey PRIMARY KEY (attr_key);


--
-- Name: nethost_attributes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY nethost_attributes
    ADD CONSTRAINT nethost_attributes_pkey PRIMARY KEY (attr_key);


--
-- Name: nethost_attributes_user_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY nethost_attributes_users
    ADD CONSTRAINT nethost_attributes_user_pkey PRIMARY KEY (attr_key);


--
-- Name: nethost_attributes_users_uniq; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY nethost_attributes_users
    ADD CONSTRAINT nethost_attributes_users_uniq UNIQUE (okey, attr, value);


--
-- Name: nethost_ikey_uniq; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY nethost
    ADD CONSTRAINT nethost_ikey_uniq UNIQUE (ikey);


--
-- Name: nethost_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY nethost
    ADD CONSTRAINT nethost_pkey PRIMARY KEY (name);


--
-- Name: netzone_attr_netzone_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY netzone_attributes_netzone
    ADD CONSTRAINT netzone_attr_netzone_pkey PRIMARY KEY (attr_key);


--
-- Name: netzone_attr_site_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY netzone_attributes_site
    ADD CONSTRAINT netzone_attr_site_pkey PRIMARY KEY (attr_key);


--
-- Name: netzone_attributes_list_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY netzone_attributes_list
    ADD CONSTRAINT netzone_attributes_list_pkey PRIMARY KEY (ikey);


--
-- Name: netzone_attributes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY netzone_attributes
    ADD CONSTRAINT netzone_attributes_pkey PRIMARY KEY (attr_key);


--
-- Name: netzone_ikey_uniq; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY netzone
    ADD CONSTRAINT netzone_ikey_uniq UNIQUE (ikey);


--
-- Name: netzone_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY netzone
    ADD CONSTRAINT netzone_pkey PRIMARY KEY (name);


--
-- Name: objects_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY objects
    ADD CONSTRAINT objects_pkey PRIMARY KEY (ikey);


--
-- Name: p_attr_l_c_uniq; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY user_attributes_list
    ADD CONSTRAINT p_attr_l_c_uniq UNIQUE (canonical);


--
-- Name: p_attr_list_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY user_attributes_list
    ADD CONSTRAINT p_attr_list_pkey PRIMARY KEY (ikey);


--
-- Name: person_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY "user"
    ADD CONSTRAINT person_pkey PRIMARY KEY (name);


--
-- Name: person_uid_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY "user"
    ADD CONSTRAINT person_uid_key UNIQUE (uidnumber);


--
-- Name: revaliases_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY revaliases
    ADD CONSTRAINT revaliases_pkey PRIMARY KEY (name);


--
-- Name: revisions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY revisions
    ADD CONSTRAINT revisions_pkey PRIMARY KEY (ikey);


--
-- Name: s_attr_l_c_uniq; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY site_attributes_list
    ADD CONSTRAINT s_attr_l_c_uniq UNIQUE (canonical);


--
-- Name: s_attr_list_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY site_attributes_list
    ADD CONSTRAINT s_attr_list_pkey PRIMARY KEY (ikey);


--
-- Name: settings_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY settings
    ADD CONSTRAINT settings_pkey PRIMARY KEY (varname);


--
-- Name: site_attributes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY site_attributes
    ADD CONSTRAINT site_attributes_pkey PRIMARY KEY (attr_key);


--
-- Name: site_okey_uniq; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY site
    ADD CONSTRAINT site_okey_uniq UNIQUE (ikey);


--
-- Name: site_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY site
    ADD CONSTRAINT site_pkey PRIMARY KEY (name);


--
-- Name: su_type_name_uniq; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY su_type
    ADD CONSTRAINT su_type_name_uniq UNIQUE (name);


--
-- Name: su_type_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY su_type
    ADD CONSTRAINT su_type_pkey PRIMARY KEY (ikey);


--
-- Name: user_attr_groups_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY user_attributes_groups
    ADD CONSTRAINT user_attr_groups_pkey PRIMARY KEY (attr_key);


--
-- Name: user_attr_site_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY user_attributes_site
    ADD CONSTRAINT user_attr_site_pkey PRIMARY KEY (attr_key);


--
-- Name: user_attr_user_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY user_attributes_users
    ADD CONSTRAINT user_attr_user_pkey PRIMARY KEY (attr_key);


--
-- Name: user_attributes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY user_attributes_base
    ADD CONSTRAINT user_attributes_pkey PRIMARY KEY (attr_key);


--
-- Name: user_ikey_uniq; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY "user"
    ADD CONSTRAINT user_ikey_uniq UNIQUE (ikey);


--
-- Name: address_attr_base_attr_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX address_attr_base_attr_idx ON address_attributes_base USING btree (attr);


--
-- Name: address_exported_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX address_exported_idx ON address USING btree (exported);


--
-- Name: aliases_exported_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX aliases_exported_idx ON aliases USING btree (exported);


--
-- Name: aliases_forwards_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX aliases_forwards_idx ON aliases USING gin (forward);


--
-- Name: aliases_forwards_lower_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX aliases_forwards_lower_idx ON aliases USING gin (string_to_array(lower(array_to_string(forward, ','::text)), ','::text));


--
-- Name: aliases_name_lower_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX aliases_name_lower_idx ON aliases USING btree (lower(name));


--
-- Name: aliases_rev_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX aliases_rev_idx ON aliases USING btree (rev);


--
-- Name: fki_accreq_attr_okey_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX fki_accreq_attr_okey_fkey ON accreq_attributes USING btree (okey);


--
-- Name: fki_accreq_attributes_list_attr_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX fki_accreq_attributes_list_attr_fkey ON accreq_attributes USING btree (attr);


--
-- Name: fki_address_attr_site_okey_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX fki_address_attr_site_okey_fkey ON address_attributes_site USING btree (okey);


--
-- Name: fki_address_attributes_okey_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX fki_address_attributes_okey_fkey ON address_attributes_base USING btree (okey);


--
-- Name: fki_address_attributes_site_attr_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX fki_address_attributes_site_attr_fkey ON address_attributes_site USING btree (attr);


--
-- Name: fki_address_attributes_site_value_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX fki_address_attributes_site_value_fkey ON address_attributes_site USING btree (value);


--
-- Name: fki_address_user_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX fki_address_user_fkey ON address USING btree ("user");


--
-- Name: fki_group_attr_okey_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX fki_group_attr_okey_fkey ON group_attributes_base USING btree (okey);


--
-- Name: fki_group_attr_sutypes_okey_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX fki_group_attr_sutypes_okey_fkey ON group_attributes_sutypes USING btree (okey);


--
-- Name: fki_group_attr_users_okey_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX fki_group_attr_users_okey_fkey ON group_attributes_users USING btree (okey);


--
-- Name: fki_group_attributes_sutypes_attr; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX fki_group_attributes_sutypes_attr ON group_attributes_sutypes USING btree (attr);


--
-- Name: fki_group_attributes_sutypes_sutype_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX fki_group_attributes_sutypes_sutype_fkey ON group_attributes_sutypes USING btree (value);


--
-- Name: fki_group_attributes_users_attr_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX fki_group_attributes_users_attr_fkey ON group_attributes_users USING btree (attr);


--
-- Name: fki_group_attributes_users_user_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX fki_group_attributes_users_user_fkey ON group_attributes_users USING btree (value);


--
-- Name: fki_nethost_attr_ip_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX fki_nethost_attr_ip_fkey ON nethost_attributes_ips USING btree (okey);


--
-- Name: fki_nethost_attr_mac_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX fki_nethost_attr_mac_fkey ON nethost_attributes_macs USING btree (okey);


--
-- Name: fki_nethost_attr_users_okey_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX fki_nethost_attr_users_okey_fkey ON nethost_attributes_users USING btree (okey);


--
-- Name: fki_nethost_attributes_attr_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX fki_nethost_attributes_attr_fkey ON nethost_attributes USING btree (attr);


--
-- Name: fki_nethost_attributes_users_attr_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX fki_nethost_attributes_users_attr_fkey ON nethost_attributes_users USING btree (attr);


--
-- Name: fki_nethost_attributes_users_user_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX fki_nethost_attributes_users_user_fkey ON nethost_attributes_users USING btree (value);


--
-- Name: fki_netzone_attr_netzone_okey_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX fki_netzone_attr_netzone_okey_fkey ON netzone_attributes_netzone USING btree (okey);


--
-- Name: fki_netzone_attr_site_okey_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX fki_netzone_attr_site_okey_fkey ON netzone_attributes_site USING btree (okey);


--
-- Name: fki_netzone_attributes_attr_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX fki_netzone_attributes_attr_fkey ON netzone_attributes USING btree (attr);


--
-- Name: fki_netzone_attributes_netzone_attr_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX fki_netzone_attributes_netzone_attr_fkey ON netzone_attributes_netzone USING btree (attr);


--
-- Name: fki_netzone_attributes_netzone_value_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX fki_netzone_attributes_netzone_value_fkey ON netzone_attributes_netzone USING btree (value);


--
-- Name: fki_netzone_attributes_site_attr_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX fki_netzone_attributes_site_attr_fkey ON netzone_attributes_site USING btree (attr);


--
-- Name: fki_netzone_attributes_site_value_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX fki_netzone_attributes_site_value_fkey ON netzone_attributes_site USING btree (value);


--
-- Name: fki_revaliase_name_user_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX fki_revaliase_name_user_fkey ON revaliases USING btree (name);


--
-- Name: fki_revaliases_user_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX fki_revaliases_user_fkey ON revaliases USING btree (name);


--
-- Name: fki_site_attributes_attr_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX fki_site_attributes_attr_fkey ON site_attributes USING btree (attr);


--
-- Name: fki_user_attr_groups_okey_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX fki_user_attr_groups_okey_fkey ON user_attributes_groups USING btree (okey);


--
-- Name: fki_user_attr_okey_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX fki_user_attr_okey_fkey ON user_attributes_base USING btree (okey);


--
-- Name: fki_user_attr_site_okey_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX fki_user_attr_site_okey_fkey ON user_attributes_site USING btree (okey);


--
-- Name: fki_user_attr_users_okey_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX fki_user_attr_users_okey_fkey ON user_attributes_users USING btree (okey);


--
-- Name: fki_user_attributes_attr_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX fki_user_attributes_attr_fkey ON user_attributes_base USING btree (attr);


--
-- Name: fki_user_attributes_groups_attr_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX fki_user_attributes_groups_attr_fkey ON user_attributes_groups USING btree (attr);


--
-- Name: fki_user_attributes_groups_value_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX fki_user_attributes_groups_value_fkey ON user_attributes_groups USING btree (value);


--
-- Name: fki_user_attributes_site_attr_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX fki_user_attributes_site_attr_fkey ON user_attributes_site USING btree (attr);


--
-- Name: fki_user_attributes_site_value_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX fki_user_attributes_site_value_fkey ON user_attributes_site USING btree (value);


--
-- Name: fki_user_attributes_users_attr_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX fki_user_attributes_users_attr_fkey ON user_attributes_users USING btree (attr);


--
-- Name: fki_user_attributes_users_value_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX fki_user_attributes_users_value_fkey ON user_attributes_users USING btree (value);


--
-- Name: group_attributes_base_value_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX group_attributes_base_value_idx ON group_attributes_base USING btree (value);


--
-- Name: group_exported_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX group_exported_idx ON "group" USING btree (exported);


--
-- Name: group_rev_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX group_rev_idx ON "group" USING btree (rev);


--
-- Name: nethost_attr_value_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX nethost_attr_value_idx ON nethost_attributes USING btree (value);


--
-- Name: nethost_attributes_ip_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX nethost_attributes_ip_idx ON nethost_attributes_ips USING btree (((value)::inet));


--
-- Name: nethost_attributes_mac_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX nethost_attributes_mac_idx ON nethost_attributes_macs USING btree (((value)::macaddr));


--
-- Name: nethost_cname_uniq_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX nethost_cname_uniq_idx ON nethost_attributes USING btree (value) WHERE (attr = 'cname'::text);


--
-- Name: netzone_attr_value_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX netzone_attr_value_idx ON netzone_attributes USING btree (value);


--
-- Name: netzone_attributes_net_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX netzone_attributes_net_idx ON netzone_attributes USING btree (((value)::inet), attr, okey) WHERE (attr = 'net'::text);


--
-- Name: netzone_attributes_netexclude_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX netzone_attributes_netexclude_idx ON netzone_attributes USING btree (((value)::inet), attr, okey) WHERE (attr = 'netExclude'::text);


--
-- Name: person_rev_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX person_rev_idx ON "user" USING btree (rev);


--
-- Name: revaliases_as_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX revaliases_as_idx ON revaliases USING btree ("as");


--
-- Name: revaliases_as_lower_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX revaliases_as_lower_idx ON revaliases USING btree (lower("as"));


--
-- Name: revaliases_exported_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX revaliases_exported_idx ON revaliases USING btree (exported);


--
-- Name: revaliases_rev_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX revaliases_rev_idx ON revaliases USING btree (rev);


--
-- Name: site_attr_value_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX site_attr_value_idx ON site_attributes USING btree (value);


--
-- Name: site_exported_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX site_exported_idx ON site USING btree (exported);


--
-- Name: site_rev_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX site_rev_idx ON site USING btree (rev);


--
-- Name: user_attr_value_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX user_attr_value_idx ON user_attributes_base USING btree (value);


--
-- Name: user_expire_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX user_expire_idx ON "user" USING btree (expire);


--
-- Name: user_exported_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX user_exported_idx ON "user" USING btree (exported);


--
-- Name: address_attributes_insert; Type: RULE; Schema: public; Owner: -
--

CREATE RULE address_attributes_insert AS ON INSERT TO address_attributes DO INSTEAD INSERT INTO address_attributes_base (value, attr, attr_key, okey) VALUES (new.value, new.attr, new.attr_key, new.okey);


--
-- Name: address_attributes_update; Type: RULE; Schema: public; Owner: -
--

CREATE RULE address_attributes_update AS ON UPDATE TO address_attributes DO INSTEAD UPDATE address_attributes_base SET value = new.value, attr = new.attr, attr_key = new.attr_key, okey = new.okey WHERE ((address_attributes_base.attr_key = old.attr_key) AND (address_attributes_base.attr = old.attr));


--
-- Name: address_atttributes_delete; Type: RULE; Schema: public; Owner: -
--

CREATE RULE address_atttributes_delete AS ON DELETE TO address_attributes DO INSTEAD DELETE FROM address_attributes_base WHERE ((address_attributes_base.attr_key = old.attr_key) AND (address_attributes_base.attr = old.attr));


--
-- Name: group_attributes_insert; Type: RULE; Schema: public; Owner: -
--

CREATE RULE group_attributes_insert AS ON INSERT TO group_attributes DO INSTEAD INSERT INTO group_attributes_base (value, attr, attr_key, okey) VALUES (new.value, new.attr, new.attr_key, new.okey);


--
-- Name: group_attributes_update; Type: RULE; Schema: public; Owner: -
--

CREATE RULE group_attributes_update AS ON UPDATE TO group_attributes DO INSTEAD UPDATE group_attributes_base SET value = new.value, attr = new.attr, attr_key = new.attr_key, okey = new.okey WHERE ((group_attributes_base.attr_key = old.attr_key) AND (group_attributes_base.attr = old.attr));


--
-- Name: group_atttributes_delete; Type: RULE; Schema: public; Owner: -
--

CREATE RULE group_atttributes_delete AS ON DELETE TO group_attributes DO INSTEAD DELETE FROM group_attributes_base WHERE ((group_attributes_base.attr_key = old.attr_key) AND (group_attributes_base.attr = old.attr));


--
-- Name: user_attributes_insert; Type: RULE; Schema: public; Owner: -
--

CREATE RULE user_attributes_insert AS ON INSERT TO user_attributes DO INSTEAD INSERT INTO user_attributes_base (value, attr, attr_key, okey) VALUES (new.value, new.attr, new.attr_key, new.okey);


--
-- Name: user_attributes_update; Type: RULE; Schema: public; Owner: -
--

CREATE RULE user_attributes_update AS ON UPDATE TO user_attributes DO INSTEAD UPDATE user_attributes_base SET value = new.value, attr = new.attr, attr_key = new.attr_key, okey = new.okey WHERE ((user_attributes_base.attr_key = old.attr_key) AND (user_attributes_base.attr = old.attr));


--
-- Name: user_atttributes_delete; Type: RULE; Schema: public; Owner: -
--

CREATE RULE user_atttributes_delete AS ON DELETE TO user_attributes DO INSTEAD DELETE FROM user_attributes_base WHERE ((user_attributes_base.attr_key = old.attr_key) AND (user_attributes_base.attr = old.attr));


--
-- Name: accreq_update_rev_tg; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER accreq_update_rev_tg
    BEFORE INSERT OR DELETE OR UPDATE ON accreq
    FOR EACH ROW
    EXECUTE PROCEDURE rev_tg_f();


--
-- Name: address_attr_update_ref_a_s; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER address_attr_update_ref_a_s
    AFTER INSERT OR DELETE OR UPDATE ON address_attributes_site
    FOR EACH ROW
    EXECUTE PROCEDURE address_attr_update_ref();


--
-- Name: address_attr_update_ref_tg; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER address_attr_update_ref_tg
    AFTER INSERT OR DELETE OR UPDATE ON address_attributes_base
    FOR EACH ROW
    EXECUTE PROCEDURE address_attr_update_ref();


--
-- Name: address_sort_fields_tg; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER address_sort_fields_tg
    BEFORE INSERT OR DELETE OR UPDATE ON address_attributes_base
    FOR EACH ROW
    EXECUTE PROCEDURE address_sort_fields();


--
-- Name: address_update_rev_tg; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER address_update_rev_tg
    BEFORE INSERT OR DELETE OR UPDATE ON address
    FOR EACH ROW
    EXECUTE PROCEDURE rev_tg_f();


--
-- Name: address_update_user_rev_tg; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER address_update_user_rev_tg
    AFTER INSERT OR DELETE OR UPDATE ON address
    FOR EACH ROW
    EXECUTE PROCEDURE address_update_user_rev();


--
-- Name: aliases_nickname_tg; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER aliases_nickname_tg
    AFTER DELETE OR UPDATE ON aliases
    FOR EACH ROW
    EXECUTE PROCEDURE aliases_nickname();


--
-- Name: aliases_rev_tg; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER aliases_rev_tg
    BEFORE INSERT OR DELETE OR UPDATE ON aliases
    FOR EACH ROW
    EXECUTE PROCEDURE rev_tg_f();


--
-- Name: department_group_upd_tg; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER department_group_upd_tg
    AFTER INSERT OR UPDATE ON user_attributes_groups
    FOR EACH ROW
    EXECUTE PROCEDURE department_group_upd_f();


--
-- Name: fmt_macaddr_tg; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER fmt_macaddr_tg
    BEFORE INSERT OR UPDATE ON nethost_attributes_macs
    FOR EACH ROW
    EXECUTE PROCEDURE fmt_macaddr();


--
-- Name: group_attr_update; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER group_attr_update
    AFTER INSERT OR DELETE OR UPDATE ON group_attributes_base
    FOR EACH ROW
    EXECUTE PROCEDURE group_attr_update_ref();


--
-- Name: group_attr_user_update_user_ref_tg; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER group_attr_user_update_user_ref_tg
    AFTER INSERT OR DELETE OR UPDATE ON group_attributes_users
    FOR EACH ROW
    EXECUTE PROCEDURE group_attr_user_update_user_ref();


--
-- Name: group_attributes_sutypes_update_ref; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER group_attributes_sutypes_update_ref
    AFTER INSERT OR DELETE OR UPDATE ON group_attributes_sutypes
    FOR EACH ROW
    EXECUTE PROCEDURE group_attr_update_ref();


--
-- Name: group_attributes_users_update_ref; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER group_attributes_users_update_ref
    AFTER INSERT OR DELETE OR UPDATE ON group_attributes_users
    FOR EACH ROW
    EXECUTE PROCEDURE group_attr_update_ref();


--
-- Name: group_rev_tg; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER group_rev_tg
    BEFORE DELETE OR UPDATE ON "group"
    FOR EACH ROW
    EXECUTE PROCEDURE rev_tg_f();


--
-- Name: group_sort_field_tg; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER group_sort_field_tg
    BEFORE INSERT OR DELETE OR UPDATE ON group_attributes_base
    FOR EACH ROW
    EXECUTE PROCEDURE group_sort_fields();


--
-- Name: nethost_attr_ip_update; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER nethost_attr_ip_update
    AFTER INSERT OR DELETE OR UPDATE ON nethost_attributes_ips
    FOR EACH ROW
    EXECUTE PROCEDURE nethost_attr_update_ref();


--
-- Name: nethost_attr_mac_update; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER nethost_attr_mac_update
    AFTER INSERT OR DELETE OR UPDATE ON nethost_attributes_macs
    FOR EACH ROW
    EXECUTE PROCEDURE nethost_attr_update_ref();


--
-- Name: nethost_attr_update; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER nethost_attr_update
    AFTER INSERT OR DELETE OR UPDATE ON nethost_attributes
    FOR EACH ROW
    EXECUTE PROCEDURE nethost_attr_update_ref();


--
-- Name: nethost_attributes_users_update_ref; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER nethost_attributes_users_update_ref
    AFTER INSERT OR DELETE OR UPDATE ON nethost_attributes_users
    FOR EACH ROW
    EXECUTE PROCEDURE nethost_attr_update_ref();


--
-- Name: nethost_sort_field_tg; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER nethost_sort_field_tg
    BEFORE INSERT OR DELETE OR UPDATE ON nethost_attributes
    FOR EACH ROW
    EXECUTE PROCEDURE nethost_sort_fields();


--
-- Name: nethost_upd_zone_tg_del; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER nethost_upd_zone_tg_del
    BEFORE DELETE ON nethost
    FOR EACH ROW
    EXECUTE PROCEDURE nethost_upd_zone();


--
-- Name: nethost_upd_zone_tg_insupd; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER nethost_upd_zone_tg_insupd
    AFTER INSERT OR UPDATE ON nethost
    FOR EACH ROW
    EXECUTE PROCEDURE nethost_upd_zone();


--
-- Name: nethost_update_rev_tg; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER nethost_update_rev_tg
    BEFORE INSERT OR DELETE OR UPDATE ON nethost
    FOR EACH ROW
    EXECUTE PROCEDURE rev_tg_f();


--
-- Name: nethostipdel_upd_zone_tg; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER nethostipdel_upd_zone_tg
    BEFORE DELETE ON nethost_attributes_ips
    FOR EACH ROW
    EXECUTE PROCEDURE nethostipdel_upd_zone();


--
-- Name: netzone_attr_update; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER netzone_attr_update
    AFTER INSERT OR DELETE OR UPDATE ON netzone_attributes
    FOR EACH ROW
    EXECUTE PROCEDURE netzone_attr_update_ref();


--
-- Name: netzone_attr_update_ref_a_s; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER netzone_attr_update_ref_a_s
    AFTER INSERT OR DELETE OR UPDATE ON netzone_attributes_site
    FOR EACH ROW
    EXECUTE PROCEDURE netzone_attr_update_ref();


--
-- Name: netzone_attr_update_ref_a_s; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER netzone_attr_update_ref_a_s
    AFTER INSERT OR DELETE OR UPDATE ON netzone_attributes_netzone
    FOR EACH ROW
    EXECUTE PROCEDURE netzone_attr_update_ref();


--
-- Name: netzone_sort_fields_tg; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER netzone_sort_fields_tg
    BEFORE INSERT OR DELETE OR UPDATE ON netzone_attributes
    FOR EACH ROW
    EXECUTE PROCEDURE netzone_sort_fields();


--
-- Name: netzone_update_rev_tg; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER netzone_update_rev_tg
    BEFORE INSERT OR DELETE OR UPDATE ON netzone
    FOR EACH ROW
    EXECUTE PROCEDURE rev_tg_f();


--
-- Name: person_attr_update; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER person_attr_update
    AFTER INSERT OR DELETE OR UPDATE ON user_attributes_base
    FOR EACH ROW
    EXECUTE PROCEDURE person_attr_update_ref();


--
-- Name: person_attr_update_ref_a_g; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER person_attr_update_ref_a_g
    AFTER INSERT OR DELETE OR UPDATE ON user_attributes_groups
    FOR EACH ROW
    EXECUTE PROCEDURE person_attr_update_ref();


--
-- Name: person_attr_update_ref_a_s; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER person_attr_update_ref_a_s
    AFTER INSERT OR DELETE OR UPDATE ON user_attributes_site
    FOR EACH ROW
    EXECUTE PROCEDURE person_attr_update_ref();


--
-- Name: person_attr_update_ref_a_u; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER person_attr_update_ref_a_u
    AFTER INSERT OR DELETE OR UPDATE ON user_attributes_users
    FOR EACH ROW
    EXECUTE PROCEDURE person_attr_update_ref();


--
-- Name: person_rev_tg; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER person_rev_tg
    BEFORE DELETE OR UPDATE ON "user"
    FOR EACH ROW
    EXECUTE PROCEDURE rev_tg_f();


--
-- Name: revaliases_rev_tg; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER revaliases_rev_tg
    BEFORE INSERT OR DELETE OR UPDATE ON revaliases
    FOR EACH ROW
    EXECUTE PROCEDURE rev_tg_f();


--
-- Name: revisions_rev_tg; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER revisions_rev_tg
    AFTER DELETE OR UPDATE ON revisions
    FOR EACH ROW
    EXECUTE PROCEDURE rev_tg_f();


--
-- Name: settings_revision_tg; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER settings_revision_tg
    BEFORE INSERT OR DELETE OR UPDATE ON settings
    FOR EACH ROW
    EXECUTE PROCEDURE rev_tg_f();


--
-- Name: site_attr_update; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER site_attr_update
    AFTER INSERT OR DELETE OR UPDATE ON site_attributes
    FOR EACH ROW
    EXECUTE PROCEDURE site_attr_update_ref();


--
-- Name: update_address_site_tg; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER update_address_site_tg
    BEFORE INSERT OR DELETE OR UPDATE ON site
    FOR EACH ROW
    EXECUTE PROCEDURE update_address_site();


--
-- Name: user_sort_field_tg; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER user_sort_field_tg
    BEFORE INSERT OR DELETE OR UPDATE ON user_attributes_base
    FOR EACH ROW
    EXECUTE PROCEDURE user_sort_fields();


--
-- Name: accreq_attr_okey_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY accreq_attributes
    ADD CONSTRAINT accreq_attr_okey_fkey FOREIGN KEY (okey) REFERENCES accreq(ikey) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: accreq_attributes_list_attr_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY accreq_attributes
    ADD CONSTRAINT accreq_attributes_list_attr_fkey FOREIGN KEY (attr) REFERENCES accreq_attributes_list(canonical);


--
-- Name: address_attr_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY address_attributes_base
    ADD CONSTRAINT address_attr_fkey FOREIGN KEY (attr) REFERENCES address_attributes_list(canonical) ON UPDATE CASCADE;


--
-- Name: address_attributes_okey_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY address_attributes_base
    ADD CONSTRAINT address_attributes_okey_fkey FOREIGN KEY (okey) REFERENCES address(ikey) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: address_attributes_site_attr_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY address_attributes_site
    ADD CONSTRAINT address_attributes_site_attr_fkey FOREIGN KEY (attr) REFERENCES address_attributes_list_site(canonical) ON UPDATE CASCADE;


--
-- Name: address_attributes_site_okey_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY address_attributes_site
    ADD CONSTRAINT address_attributes_site_okey_fkey FOREIGN KEY (okey) REFERENCES address(ikey) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: address_attributes_site_value_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY address_attributes_site
    ADD CONSTRAINT address_attributes_site_value_fkey FOREIGN KEY (value) REFERENCES site(name) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;


--
-- Name: address_user_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY address
    ADD CONSTRAINT address_user_fkey FOREIGN KEY ("user") REFERENCES "user"(name) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: group_attr_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY group_attributes_base
    ADD CONSTRAINT group_attr_fkey FOREIGN KEY (attr) REFERENCES group_attributes_list(canonical) ON UPDATE CASCADE;


--
-- Name: group_attr_okey_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY group_attributes_base
    ADD CONSTRAINT group_attr_okey_fkey FOREIGN KEY (okey) REFERENCES "group"(ikey) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: group_attr_sutypes_okey_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY group_attributes_sutypes
    ADD CONSTRAINT group_attr_sutypes_okey_fkey FOREIGN KEY (okey) REFERENCES "group"(ikey) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: group_attr_users_okey_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY group_attributes_users
    ADD CONSTRAINT group_attr_users_okey_fkey FOREIGN KEY (okey) REFERENCES "group"(ikey) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: group_attributes_sutypes_attr; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY group_attributes_sutypes
    ADD CONSTRAINT group_attributes_sutypes_attr FOREIGN KEY (attr) REFERENCES group_attributes_list(canonical) ON UPDATE CASCADE;


--
-- Name: group_attributes_sutypes_sutype_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY group_attributes_sutypes
    ADD CONSTRAINT group_attributes_sutypes_sutype_fkey FOREIGN KEY (value) REFERENCES su_type(name) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: group_attributes_users_attr_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY group_attributes_users
    ADD CONSTRAINT group_attributes_users_attr_fkey FOREIGN KEY (attr) REFERENCES group_attributes_list(canonical) ON UPDATE CASCADE;


--
-- Name: group_attributes_users_user_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY group_attributes_users
    ADD CONSTRAINT group_attributes_users_user_fkey FOREIGN KEY (value) REFERENCES "user"(name) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: nethost_attr_ip_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY nethost_attributes_ips
    ADD CONSTRAINT nethost_attr_ip_fkey FOREIGN KEY (okey) REFERENCES nethost(ikey) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: nethost_attr_mac_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY nethost_attributes_macs
    ADD CONSTRAINT nethost_attr_mac_fkey FOREIGN KEY (okey) REFERENCES nethost(ikey) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: nethost_attr_users_okey_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY nethost_attributes
    ADD CONSTRAINT nethost_attr_users_okey_fkey FOREIGN KEY (okey) REFERENCES nethost(ikey) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: nethost_attr_users_okey_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY nethost_attributes_users
    ADD CONSTRAINT nethost_attr_users_okey_fkey FOREIGN KEY (okey) REFERENCES nethost(ikey) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: nethost_attributes_attr_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY nethost_attributes
    ADD CONSTRAINT nethost_attributes_attr_fkey FOREIGN KEY (attr) REFERENCES nethost_attributes_list(canonical) ON UPDATE CASCADE;


--
-- Name: nethost_attributes_users_attr_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY nethost_attributes_users
    ADD CONSTRAINT nethost_attributes_users_attr_fkey FOREIGN KEY (attr) REFERENCES nethost_attributes_list(canonical) ON UPDATE CASCADE;


--
-- Name: nethost_attributes_users_user_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY nethost_attributes_users
    ADD CONSTRAINT nethost_attributes_users_user_fkey FOREIGN KEY (value) REFERENCES "user"(name) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: netzone_attr_users_okey_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY netzone_attributes
    ADD CONSTRAINT netzone_attr_users_okey_fkey FOREIGN KEY (okey) REFERENCES netzone(ikey) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: netzone_attributes_attr_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY netzone_attributes
    ADD CONSTRAINT netzone_attributes_attr_fkey FOREIGN KEY (attr) REFERENCES netzone_attributes_list(canonical) ON UPDATE CASCADE;


--
-- Name: netzone_attributes_netzone_attr_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY netzone_attributes_netzone
    ADD CONSTRAINT netzone_attributes_netzone_attr_fkey FOREIGN KEY (attr) REFERENCES netzone_attributes_list(canonical) ON UPDATE CASCADE;


--
-- Name: netzone_attributes_netzone_okey_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY netzone_attributes_netzone
    ADD CONSTRAINT netzone_attributes_netzone_okey_fkey FOREIGN KEY (okey) REFERENCES netzone(ikey) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: netzone_attributes_netzone_value_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY netzone_attributes_netzone
    ADD CONSTRAINT netzone_attributes_netzone_value_fkey FOREIGN KEY (value) REFERENCES netzone(name) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;


--
-- Name: netzone_attributes_site_attr_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY netzone_attributes_site
    ADD CONSTRAINT netzone_attributes_site_attr_fkey FOREIGN KEY (attr) REFERENCES netzone_attributes_list(canonical) ON UPDATE CASCADE;


--
-- Name: netzone_attributes_site_okey_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY netzone_attributes_site
    ADD CONSTRAINT netzone_attributes_site_okey_fkey FOREIGN KEY (okey) REFERENCES netzone(ikey) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: netzone_attributes_site_value_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY netzone_attributes_site
    ADD CONSTRAINT netzone_attributes_site_value_fkey FOREIGN KEY (value) REFERENCES site(name) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;


--
-- Name: revaliase_name_user_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY revaliases
    ADD CONSTRAINT revaliase_name_user_fkey FOREIGN KEY (name) REFERENCES "user"(name) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: site_attr_users_okey_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY site_attributes
    ADD CONSTRAINT site_attr_users_okey_fkey FOREIGN KEY (okey) REFERENCES site(ikey) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: site_attributes_attr_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY site_attributes
    ADD CONSTRAINT site_attributes_attr_fkey FOREIGN KEY (attr) REFERENCES site_attributes_list(canonical) ON UPDATE CASCADE;


--
-- Name: user_attr_okey_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY user_attributes_base
    ADD CONSTRAINT user_attr_okey_fkey FOREIGN KEY (okey) REFERENCES "user"(ikey) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: user_attributes_attr_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY user_attributes_base
    ADD CONSTRAINT user_attributes_attr_fkey FOREIGN KEY (attr) REFERENCES user_attributes_list(canonical) ON UPDATE CASCADE;


--
-- Name: user_attributes_groups_attr_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY user_attributes_groups
    ADD CONSTRAINT user_attributes_groups_attr_fkey FOREIGN KEY (attr) REFERENCES user_attributes_list(canonical) ON UPDATE CASCADE;


--
-- Name: user_attributes_groups_value_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY user_attributes_groups
    ADD CONSTRAINT user_attributes_groups_value_fkey FOREIGN KEY (value) REFERENCES "group"(name) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;


--
-- Name: user_attributes_site_attr_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY user_attributes_site
    ADD CONSTRAINT user_attributes_site_attr_fkey FOREIGN KEY (attr) REFERENCES user_attributes_list(canonical) ON UPDATE CASCADE;


--
-- Name: user_attributes_site_value_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY user_attributes_site
    ADD CONSTRAINT user_attributes_site_value_fkey FOREIGN KEY (value) REFERENCES site(name) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;


--
-- Name: user_attributes_users_attr_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY user_attributes_users
    ADD CONSTRAINT user_attributes_users_attr_fkey FOREIGN KEY (attr) REFERENCES user_attributes_list(canonical) ON UPDATE CASCADE;


--
-- Name: user_attributes_users_value_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY user_attributes_users
    ADD CONSTRAINT user_attributes_users_value_fkey FOREIGN KEY (value) REFERENCES "user"(name) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;


--
-- Name: user_site_attr_okey_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY user_attributes_site
    ADD CONSTRAINT user_site_attr_okey_fkey FOREIGN KEY (okey) REFERENCES "user"(ikey) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: user_users_attr_okey_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY user_attributes_users
    ADD CONSTRAINT user_users_attr_okey_fkey FOREIGN KEY (okey) REFERENCES "user"(ikey) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: user_users_attr_okey_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY user_attributes_groups
    ADD CONSTRAINT user_users_attr_okey_fkey FOREIGN KEY (okey) REFERENCES "user"(ikey) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- PostgreSQL database dump complete
--

