-
Notifications
You must be signed in to change notification settings - Fork 900
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
Foreign keys to hypertables are not supported (except when they are) #1394
Comments
@jonfreedman Thanks for the bug report - will try to reproduce + triage. |
Having the same issue. Any updates when it will be fixed? |
Same here.. |
I have the same issue still when I use hibernate. Got the error: org.postgresql.util.PSQLException: ERROR: foreign keys to hypertables are not supported |
@taavit21 @iosifnicolae2 @smpshehan Thanks for letting us know that this is also an issue for you. This will certainly affect our prioritizations. We also welcome community contributions if someone is interested in creating a PR. |
I also getting the same issue when I using NodeJS and Sequelize to associate table for many-to-many relations. |
Is there any new development to deal with the error of this topic or with the next related issue with hypertables using foreign key constraints in PostgreSQL?#To Reproduce, there are next tables:
#To fill the table with the appropriate values:
#Then set it NOT NULL: #To define the foreign key:
#Response of the last reference table to enable foreign key: Expected behavior:
Actual behavior and error:
*According to https://docs.timescale.com/timescaledb/latest/overview/limitations/##distributed-hypertable-limitations, it looks like the above error is part of the hypertable limitations:
#Request: Actually, I have obtained similar of above error when I have attempted to create many-to-many relation among the tables metrics and job_metric specifically using the Django Rest Framework:
Running the application metrics pointing out directly metrics_db
Please share, if someone knows a solution or have an idea to deal with the above error at the REST API level to access data associated tables (metrics and jobs) given the timescaledb extension seems do not a viable solution. |
@jonfreedman Tried to reproduce the initial example on the most recent version of TimescaleDB (2.4.2) and it fails on creating the second test table with the error: "ERROR: foreign keys to hypertables are not supported". So, it seems this is the expected behavior. Closing the issue. Please reopen if this turns out to still be a problem. |
Where we can track where this functionality will be implemented? Thank you! |
I don't understand why do you close this issue? I understand that it is not a bug. But we need that feature. Having a foreign key to another table is a fundamental feature of a relational database. Without that, how can we create the relations? |
What is your solution to create a reference to a hypertable from another table? |
This issue was filed as a bug, which now cannot be reproduced. So the current behavior is as intended. For the feature request of supporting foreign keys to hypertables, please refer to the following issue: #498 |
Describe the bug
It's possible to create a table which has a foreign key into a hypertable provided the foreign key is defined when the table is created
To Reproduce
Expected behavior
Either second table cannot be created, or dropping and re-creating the foreign key is valid.
Actual behavior
Tables are created but FK cannot be dropped and re-created
The text was updated successfully, but these errors were encountered: