Composite primary keys are unsupported
Closed this issue · 1 comments
carldr commented
annotaterb version: 4.10.1
I have tables with composite primary keys :
Table "public.cheeses"
Column | Type | Collation | Nullable | Default
------------------------+--------------------------------+-----------+----------+--------------------------------------
id | bigint | | not null | nextval('cheeses_id_seq'::regclass)
team_id | bigint | | not null |
Indexes:
"cheeses_pkey" PRIMARY KEY, btree (team_id, id)
Annotations look like :
# == Schema Information
#
# Table name: cheeses
#
# id :bigint not null, primary key
# team_id :bigint not null
If the primary key is composite, all the columns making up the primary key should be indicated. And perhaps, the primary key should be indicated in the indexes section, like this :
# == Schema Information
#
# Table name: cheeses
#
# id :bigint not null, primary key
# team_id :bigint not null, primary key
#
# Indexes
#
# cheeses_pkey (team_id, id) primary key
It looks like the first part of this should already work looking at AnnotationBuilder#is_column_primary_key
.
I'll look at the issue and create a pull request once this annoys me sufficiently.
carldr commented
Spotted the problem, it was with me.