create table "EnumTest$B" (
type varchar(255) not null check (type in ('A','B')),
id bigint not null,
cost numeric(10,0) not null,
code varchar(12) not null,
primary key (code, cost, id, type)
)
create table A (
id integer generated by default as identity,
"b_code" varchar(255),
"b_cost" bigint,
"b_id" numeric(38,2),
"b_type" varchar(12),
primary key (id)
)
alter table if exists A
add constraint FK60kjd2qxbg6infjjee27fhvjp
foreign key ("b_type", "b_id", "b_cost", "b_code")
references "EnumTest$B"