PGRST105 Filters must include all and only primary key columns with 'eq' operators #2661
-
Environment
Description of issueWith a table with a single column as primary key I expect to be able to create or replace records using PUT statements, but I always get a message saying PGRST105 Filters must include all and only primary key columns with 'eq' operators. Suppose PostgREST has a base URL like http://host:port and I create a table named test : create table test(id TEXT NOT NULL PRIMARY KEY, bla TEXT); After inserting ('een', 'fiets') (using psql) request http://host:port/test returns '[{"id":"een","bla":"fiets"}]' as expected. I can insert a new record via PostgREST with: curl "http://host:port/test" -X POST -H "Content-Type: application/json" -d '{"id":"twee","bla":"auto"}' Now the previous query returns '[{"id":"een","bla":"fiets"}, {"id":"twee","bla":"auto"}]' So POSTS work as a means to add records. Selecting a specific record works too: curl "http://host:port/test?id=eq.twee" Adding a new record with PUT fails: curl "http://host:port/test?id=eq.drie" -X PUT -H "Content-Type: application/json" -d '{"id":"drie","bla":"trein"}' {"code":"PGRST105","details":null,"hint":null,"message":"Filters must include all and only primary key columns with 'eq' operators"} The same result when I want to replace a record with an existing id. For inserts I can use POSTs to replace the PUTs, but updates fail. Am I doing something wrong? I cannot find any references to this PGRST105 error from people experiencing the same issue. I'm a beginner with PostgREST. I like it very much! I guess I'm doing something wrong. Thanks, Fred |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Hello, Looks like you might be running into a stale schema cache, try reloading it. See https://postgrest.org/en/stable/schema_cache.html#schema-cache-reloading |
Beta Was this translation helpful? Give feedback.
-
Hi, I have an issue that is related to this one, but I doesn't seem to be related to schema cache, I hope you could help me diagnose it. Let's say I have a table
INSERT INTO gorenove_services_data.output_service_simulation_dpe_v4 (customer_id, item_id, created_at, region)
VALUES ('abc', 'def', '2023-08-02 14:30:00','38');
But I try to use I get This might be related, but :
Do you have any idea ? I don't know haskell but I tried looking for the condition that could raise the Thanks in advance, Pascal Schetelat |
Beta Was this translation helpful? Give feedback.
Hello,
Looks like you might be running into a stale schema cache, try reloading it. See https://postgrest.org/en/stable/schema_cache.html#schema-cache-reloading