 ('{"id": "C3333333-3333-3333-3333-333333333333", "cprefix": "x2", "cindex": "z3", "tablebId": "B2222222-2222-2222-2222-222222222222"}'),
 ('{"id": "C4444444-4444-4444-4444-444444444444", "cprefix": "x4", "cindex": "z4", "tablebId": "B3333333-3333-3333-3333-333333333333"}');
 INSERT INTO tablec (jsonb) VALUES (jsonb_build_object('id', md5('c' || generate_series(1, 2000)::text)));
-
-
-INSERT INTO tablej (jsonb) VALUES
-('{"id": "J1111111-1111-1111-1111-111111111111", "copyrightTracking_copyrightStatusId": "x1"}'),
-('{"id": "J2222222-2222-2222-2222-222222222222", "name": "x2"}')

DROP TABLE IF EXISTS tablea, tableb, tablec, tablef;
CREATE EXTENSION IF NOT EXISTS unaccent WITH SCHEMA public;
CREATE OR REPLACE FUNCTION f_unaccent(text) RETURNS text AS $$
  SELECT public.unaccent('public.unaccent', $1);
$$ LANGUAGE sql IMMUTABLE;
CREATE TABLE tablef (id UUID PRIMARY KEY, jsonb JSONB NOT NULL);
CREATE TABLE tablea (id UUID PRIMARY KEY, jsonb JSONB NOT NULL);
CREATE TABLE tableb (id UUID PRIMARY KEY, jsonb JSONB NOT NULL, tableaId UUID references tablea, tablefId UUID references tablef, tablejId UUID references tablej);
CREATE TABLE tablec (id UUID PRIMARY KEY, jsonb JSONB NOT NULL, tablebId UUID references tableb);
CREATE TABLE tablej (id UUID PRIMARY KEY, jsonb JSONB NOT NULL);

CREATE OR REPLACE FUNCTION update_id() RETURNS TRIGGER AS $$
BEGIN

CREATE TRIGGER update_tablea_references BEFORE INSERT OR UPDATE ON tablea
  FOR EACH ROW EXECUTE PROCEDURE update_id();
CREATE TRIGGER update_tablef_references BEFORE INSERT OR UPDATE ON tablef
  FOR EACH ROW EXECUTE PROCEDURE update_id();
CREATE TRIGGER update_tablej_references BEFORE INSERT OR UPDATE ON tablej
  FOR EACH ROW EXECUTE PROCEDURE update_id();

CREATE OR REPLACE FUNCTION update_tableb_references() RETURNS TRIGGER AS $$
