Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow array relationships based on array type columns #4464

Closed
ravensnowbird opened this issue Apr 18, 2020 · 10 comments
Closed

allow array relationships based on array type columns #4464

ravensnowbird opened this issue Apr 18, 2020 · 10 comments
Labels
c/creating-schema Related to GraphQL schema creation c/server Related to server

Comments

@ravensnowbird
Copy link

It is possible to have array relationships to directly map to an array field in postgres without any middle table connection.

Conversations table

add_column :conversations, :user_ids, :uuid, array: true

hasura-array-relationships

@rikinsk
Copy link
Member

rikinsk commented May 19, 2020

@ravensnowbird Unfortunately I am not quite sure of the use case here. Can you maybe share some more details on what you are expecting and how it would be useful.

PS: Sorry for the delay in response. This seems to have been missed somehow.

@rikinsk rikinsk added the support/needs-more-info Needs more details/info/repro instructions label May 19, 2020
@rikinsk
Copy link
Member

rikinsk commented May 19, 2020

Actually I think I get it now. You would like to have an array relationship to the users table via the user_ids array type column of conversation table.

@rikinsk rikinsk added c/server Related to server and removed support/needs-more-info Needs more details/info/repro instructions labels May 19, 2020
@rikinsk rikinsk changed the title Array Relationship for an Array Field allow array relationships based on array type columns May 19, 2020
@rikinsk rikinsk added the c/creating-schema Related to GraphQL schema creation label May 19, 2020
@ravensnowbird
Copy link
Author

@rikinsk Yes. Postgres by default supports array field of strings/integers. These can be used to form a relationship directly avoiding a middle table users_conversations.

@ghyath5
Copy link

ghyath5 commented Sep 1, 2020

@ravensnowbird

Did you find any work-around to do this kind of array relationship ?

@ravensnowbird
Copy link
Author

ravensnowbird commented Nov 5, 2020

Actually I think I get it now. You would like to have an array relationship to the users table via the user_ids array type column of conversation table.

Exactly. this is working with an array relationship. It didn't work in the old version. it works on the latest one. I guess it must have been some bug. Closing this now.

@pandoratoolbox
Copy link

pandoratoolbox commented Apr 28, 2021

This isn't working in Hasura v2.0.0-alpha.9, produces error: "error": { "exec_status": "FatalError", "hint": "No operator matches the given name and argument types. You might need to add explicit type casts.", "message": "operator does not exist: bigint[] = bigint", "status_code": "42883", "description": null },

@efstathiosntonas
Copy link

efstathiosntonas commented Jul 12, 2022

any news in this? ^^ many customers have this issue (many open issues). Yes, intermediate table is a solution but we want to avoid it.

@sounden
Copy link

sounden commented Jan 23, 2023

Yepp looking for same functionallity.

@gherciu
Copy link

gherciu commented Jun 7, 2023

@rikinsk ^^

@kokroo
Copy link

kokroo commented Jun 15, 2023

Looking for the same!

EDIT:

I figured out a workaround using computed fields. I created a function in SQL to return rows based on some logic, and then I created a computed field that points to this function. Works beautifully!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c/creating-schema Related to GraphQL schema creation c/server Related to server
Projects
None yet
Development

No branches or pull requests

8 participants