Error PGRST200 on a view #3431
-
Environment
Description of issueI get this error message : {"code":"PGRST200","details":"Searched for a foreign key relationship between 'v_non_pointe' and 'analytique' in the schema 'public', but no matches were found.","hint":null,"message":"Could not find a relationship between 'v_non_pointe' and 'analytique' in the schema cache"} when I run this request : curl -i -H "Authorization: Bearer xxxx" "http://xxxx/v_non_pointe?order=datemvt.desc,numero&offset=0&limit=12&analytique_uuid=eq.c04cb04d-ba83-c172-8125-907eca9475b5&select=datemvt,numero,tiers,analytique(groupe),montant,typemvt(code),devise(code,libelle),sts" The view is as follows : CREATE OR REPLACE VIEW public.v_non_pointe
AS
SELECT mouvement.numero,
mouvement.datemvt,
mouvement.dateval,
mouvement.tiers,
mouvement.debit_devise,
mouvement.retrait,
mouvement.credit_devise,
mouvement.versement,
mouvement.montant,
mouvement.horsbudget,
mouvement.saisie,
analytique.analytique_uuid,
compte.compte_uuid,
devise.devise_uuid,
devise.libelle,
mouvement.taux,
typemvt.typemvt_uuid,
mouvement.mouvement_uuid,
mouvement.sts
FROM mouvement
JOIN analytique ON mouvement.analytique_uuid = analytique.analytique_uuid
JOIN compte ON mouvement.compte_uuid = compte.compte_uuid
JOIN devise ON mouvement.devise_uuid = devise.devise_uuid
JOIN typemvt ON mouvement.typemvt_uuid = typemvt.typemvt_uuid
WHERE mouvement.datemvt IS NOT NULL AND mouvement.pointage IS FALSE AND mouvement.flag = 'Z'::bpchar
ORDER BY mouvement.datemvt DESC, typemvt.code, mouvement.numero; So, there IS a relationship between the view and the table "analytique". |
Beta Was this translation helpful? Give feedback.
Answered by
laurenceisla
Apr 22, 2024
Replies: 1 comment 1 reply
-
The view must Check the docs for more info. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
VinceT
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The view must
SELECT
the column that has the foreign key to the tableanalytique
. You selectedanalytique.analytique_uuid
in the view, but that column does not have a FK to that table. If you selectmouvement.analytique_uuid
instead (which has the FK), then it should allow you to embed theanalytique
table.Check the docs for more info.