question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Creating relationship failed. table not exists when creating manual relation

See original GitHub issue

I have a table of users and a table followers with user_id and follower_id

I’m trying to create a view so I can see from a user who users he/she follows and also who follows him/her?

Table users

id
email

Table users_followers

id 
user_id FK --> users
follower_id FK --> users

To see the followers of a user, I created an array relationship followers on users table users_followers . user_id → users . id

and then to be able to see who is following a user, I created the following view

CREATE VIEW following_me AS 
  SELECT u.id as user_id,
    u1.*
    FROM users u 
    LEFT JOIN users_followers f ON u.id = f.follower_id 
    INNER JOIN users u1 ON f.user_id = u1.id;

and then when I try to create a manual relation from the users table to the following_me view as a reference table (users.id --> following_me.user_id), even tho it does appear on the tables dropdown with all the correct fields, when I save, I get and error that says following_me table does not exists

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
marionschleifercommented, Nov 22, 2019

@tafelito I’m closing this issue. Feel free to re-open if you’d like to add something 🙂

0reactions
tafelitocommented, Oct 8, 2019

I was indeed just creating the view as I mentioned before. I was not creating a function. Doing what you suggested actually worked. So the view was created and now I’m able to track it. It just won’t allow me to track it when I create it from the SQL editor. I can do more tests if you need me to. Thanks @rikinsk

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshoot table relationships - Microsoft Support
Sometimes Excel fails to detect relationship between tables. ... For more information, see Create a relationship between two tables.
Read more >
I keep getting the error "relation [TABLE] does not exist"
Each element has to be quoted individually: select "ID" from "Schema"."table1";. More details about quoted identifiers are in the manual.
Read more >
Postgres: Creating Relationships | Hasura GraphQL Docs
A relationship from one table/view to another can be created by defining a link between a column of the table/view to a column...
Read more >
Postgres : Relation does not exist error
You created your tables with double quotes, and now the names are case sensitive. As documented in the manual "Approvals" and Approvals are...
Read more >
Creating multiple tables and table relationships - Launch School
/* one-to-one: User has one address */ CREATE TABLE addresses ( user_id int, -- Both a primary and foreign key street varchar(30) NOT...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found