这是indexloc提供的服务,不要输入任何密码
Skip to content

Cannot track more than a single one-to-one relationship from parent table. #7552

@BenoitRanque

Description

@BenoitRanque

Version Information

Server Version: 2.0.9
CLI Version (for CLI related issue): 2.0.9

Environment

Tested on hasura cloud

What is the expected behaviour?

One to one relationships are possible if the foreign key on the child table is also unique.
Parent tables should be able to have multiple object relationships to different tables.

What is the current behaviour?

When I track an object relationship from the parent table, the other suggested object relationships disappear and are not suggested anymore. They come back if I remove the object relationship.

How to reproduce the issue?

My test schema is as follows: a main table, and 3 related children table.
Two are object relationships, and one is an array relationship, that one works as expected.
Note the person_id column of the pet table is not unique

CREATE TABLE public.person (
    id INT PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
    name TEXT
);
CREATE TABLE public.pet (
    id INT PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
    name TEXT,
    person_id INT NOT NULL REFERENCES public.person(id)
);
CREATE TABLE public.color (
    id INT PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
    name TEXT,
    person_id INT UNIQUE NOT NULL REFERENCES public.person(id)
);
CREATE TABLE public.car (
    id INT PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
    name TEXT,
    person_id INT UNIQUE NOT NULL REFERENCES public.person(id)
);
  1. Apply the above schema
  2. Track all tables
  3. Go to the relationships tab of the person table
  4. The 3 relationships are suggested as expected
    image
  5. Click "add" and then "save" on the relationship with the car table
  6. The car relationship is added correctly. **The color relationship is no longer suggested
    image
  7. Delete the car relationship
  8. The color relationship is suggested again.

Any possible solutions?

This can currently be worked around by removing any existing object relationship, going to the schema root, and clicking "track all". This is a workaround and not a solution.

image

Can you identify the location in the source code where the problem exists?

This happens in console, I have not had the time to look for it yet.

If the bug is confirmed, would you be willing to submit a PR?

Absolutely

Metadata

Metadata

Assignees

Labels

c/consoleRelated to consolek/bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions