Hi

While trying to setup partitioned tables, I have noticed that the code 
generator seem to have a bug or feature where it does not alway generate 
all the foreign keys. 

When running the code generator on the following H2 database:

create table parent (
  id int generated by default as identity,
  partition_id tinyint not null,
  constraint pk_parent primary key (id, partition_id)
);

create table child1 (
  id int generated by default as identity,
  parent_id int not null,
  partition_id tinyint not null,
  constraint pk_child1 primary key (id),
  constraint fk_child1_parent foreign key (parent_id, partition_id) 
references parent (id, partition_id)
);

create table child2 (
  id int generated by default as identity,
  parent_id int not null,
  constraint pk_child2 primary key (id),
  -- this fk does not cover the parents pk 
  constraint fk_child2_parent foreign key (parent_id) references parent (id)
);

The foreign key for child2 is not generated (note that this fk is a bit 
funky, since it only references part of the parent pk).

The only generator log output regarding foreign keys is this:

[INFO] Adding foreign key       : FK_CHILD1_PARENT 
(PUBLIC.CHILD1.PARENT_ID) referencing PK_PARENT (PUBLIC.PARENT.ID)
[INFO] Adding foreign key       : FK_CHILD1_PARENT 
(PUBLIC.CHILD1.PARTITION_ID) referencing PK_PARENT 
(PUBLIC.PARENT.PARTITION_ID)

I can push an example to github or supply generator log. I tested with jooq 
v1.15.2 and initially discovered it on v3.14.13.

Best regards Jens

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jooq-user/bd40cd8d-201a-404b-88db-e7bfa262a3e7n%40googlegroups.com.

Reply via email to