-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
No way to join when postgresql_fdw
is used
#591
Comments
No easy way, maybe in the relative near future there will be a way to manually specify the relations in a config, but not for now. |
What an idea :) Well, I tried this today, but I can't really get it to work. It seemed like it would, but then something else further down is probably making this not-work. The
I tried to put the relations on the postgresql_fdw view first, and after that on the materialized view. I'm not comfortable with debugging Haskell since I have trouble even reading the code (sadly quite Haskell illiterate) - and I didn't see any debug mode you could put it in. I guess I could get postgresql to log the requests, but I should probably just do something simpler like copying the tables over SSH every night. I guess this will still just be a use case which is not yet fully supported ;)
|
You don't have to debug haskell for this particular issue, i think this can work for you (it probably failed because you created the views only for that particular query i showed but you probably need to check all the queries in that file), try these steps
|
i.e. you need to create materialised views for pg_namespace pg_class pg_constraint .... and so on, check all the tables that are used in those queries. |
Closing as a duplicate of (same core problem) #709 |
Related SO question here https://dba.stackexchange.com/questions/138591/foreign-key-references-constraint-on-postgresql-foreign-data-wrapper. For now it seems that the PostgreSQL way to solve this is to sync the remote db to guarantee the constraint works properly. If we allow Resouce Embedding on foreign tables we wouldn't be talking about foreign keys anymore(even if manually indicated to PostgREST), so I agree this is a separate issue. |
Solved on #2144 |
I need to run postgrest on another machine than where the real database is. Connecting postgrest directly gave abysmal performance, so I've used
postgresql_fdw
to make postgres handle the connection. I also as an added bonus created materialized views for the tables to make the readonly lookups even more performant.I was originally thinking of replicating the database, but this frontend also use postgres for other things so didn't find a good, nice way of solving it.
Since postgresql_fdw don't allow you to set the REFERENCES annotations, there's now way for postgrest to figure out the references. Is there any way around this?
The text was updated successfully, but these errors were encountered: