Foreign keys as primary values [Apr 19]

:raising_hand_man: Harbard asked

Hi, it’s me again !

So I’m using my DB to handle translation, and I’d like to set foreign keys as primary values to avoid getting IDs in my tables.

I see in the code that the setAsPrimaryValue is not available for foreign keys, is there a technical reason. Is it worth that I spend some time trying to implement this in a PR ?


drop table if exists labels cascade;


id serial primary key,

en text,

fr text,

de text


drop table if exists schools cascade;

CREATE TABLE schools (

id serial primary key,

school_label int references labels(id)


drop table if exists class_rooms cascade;

CREATE TABLE class_rooms (

id serial primary key,

class_label int references labels(id),

school_id int references schools(id)


drop table if exists students cascade;

CREATE TABLE students (

id serial primary key,

std_label int references labels(id),

class_id int references class_rooms(id)


INSERT INTO public.labels (en,fr,de) VALUES











INSERT INTO public.schools (school_label) VALUES



INSERT INTO public.class_rooms (class_label,school_id) VALUES




INSERT INTO public.students (std_label,class_id) VALUES








:person_tipping_hand: o1lab replied

The idea of foreign key is mostly for machines :slightly_smiling_face: and hence we are avoiding that to be set as primary values

:person_tipping_hand: o1lab replied

the idea of primary value is that it has to be humanly understandabale

:raising_hand_man: Harbard replied

I understand your point. The thing is, I really need a relational DB for my use case, and I also need non-dev people to work on the DB. So nocoDB seems to be the perfect tool here !

Is my DB structure exotic ? Because I feel like it’s pretty commun. Let’s say I want to creat a new classroom and attach it to a school, the user will be faced with PK instead of the label.

:raising_hand_man: Harbard replied

Anyway, I’d be glad to discuss this topic with anyone in the team and try to help ! :pray:

:raising_hand_man: Harbard replied

What is the best place to talk about this ? Here, an issue or GitHub discussions ?

:raising_hand_man: Harbard replied

<a:kbInklingWave:630956774727483422> What do you guys think about that ?

Autogenerated from discord

Join NocoDB’s community