Skip to content

It should not throw 404 error with message of "not found". >>> (Regarding "Updating data returns an empty Exception when there is no results returned #87") #315

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

Closed
JasonChiu-dev opened this issue Dec 23, 2022 · 11 comments

Comments

@JasonChiu-dev
Copy link

    The library now throws 404 error with message of `not found` now, which is the expected behavior of Postgrest when there are no rows to update, so closing this PR as it's resolved!

Originally posted by @dshukertjr in #87 (comment)

It is so strange to throws 404 error with message of not found!!
On SQL command test, if the data is not found when doing "update" action, the SQL response "Success. No rows returned". It should not throws 404 error with message of not found.

@JasonChiu-dev
Copy link
Author

JasonChiu-dev commented Dec 23, 2022

For example, when I have the major table for the basic data (e.g. customers.customerId and customers.name) and then I have the relative table (orders) for the detail data (e.g. orders.numer, orders.customerId (foreign key relate to customer.customerId) ...) ...etc.

It is not necessary that I have to check table (orders) every time when I found I mis-typed the customers.customerId data and try to update customers table and orders table (maybe there were many records in orders table with the mis-typed the customers.customerId, or there is none in orders table using the wrong customers.customerId. I just want to update the customer table with the correct customers.customerId and update the orders table at the same time, even if the wrong customers.customerId data has not been created in the orders table. )

Because you don’t know if the order table has Relevant data, using a relational database, you must update the associated tables and data.

It is not necessary to use the query command to check whether the data has been saved before modifying the data every time. This should be judged and processed by the SQL Update command.

For your information.

Jason

@JasonChiu-dev JasonChiu-dev changed the title This is incorrect!! >> The library now throws 404 error with message of not found now, which is the expected behavior of Postgrest when there are no rows to update, so closing this PR as it's resolved! It should not throw 404 error with message of "not found". >> regarding Updating data returns an empty Exception when there is no results returned #87 Dec 23, 2022
@JasonChiu-dev JasonChiu-dev changed the title It should not throw 404 error with message of "not found". >> regarding Updating data returns an empty Exception when there is no results returned #87 It should not throw 404 error with message of "not found". >>> (Regarding "Updating data returns an empty Exception when there is no results returned #87") Dec 23, 2022
@JasonChiu-dev
Copy link
Author

@dshukertjr
Is there anyone who can help?

@dshukertjr
Copy link
Member

@JasonChiu-dev you are saying that it should just return an empty array without throwing an error, correct?

supabase-flutter is just reflecting what Postgrest returns us, so you might want to open an issue there for this.

@JasonChiu-dev
Copy link
Author

JasonChiu-dev commented Dec 23, 2022 via email

@dshukertjr
Copy link
Member

@JasonChiu-dev
Actually, I was wrong, and the js client library does have a mechanism to ignore 404 errors.
supabase/postgrest-js#295

Will fix this and ship an update ASAP!

@JasonChiu-dev
Copy link
Author

JasonChiu-dev commented Dec 23, 2022 via email

@dshukertjr
Copy link
Member

@JasonChiu-dev
Patch for this issue should be deployed on all Supabase projects, but could you check if it is still happening?
PostgREST/postgrest#2343

@JasonChiu-dev
Copy link
Author

@JasonChiu-dev Patch for this issue should be deployed on all Supabase projects, but could you check if it is still happening? PostgREST/postgrest#2343
The same situation still exists. I still get the same error message.

截圖 2022-12-26 下午12 09 34

@dshukertjr
Copy link
Member

dshukertjr commented Dec 26, 2022

@JasonChiu-dev
Can you contact [email protected] about this with your project reference? We can take a look at your project and make sure it is upgraded.

Will follow up on the support ticket.

@steve-chavez
Copy link
Member

@JasonChiu-dev You can check your postgrest version as described here.

If you have a version >= v10.1.0, the 404 error on update should not happen.

@JasonChiu-dev
Copy link
Author

JasonChiu-dev commented Dec 27, 2022

@JasonChiu-dev You can check your postgrest version as described here.

If you have a version >= v10.1.0, the 404 error on update should not happen.

This is correct. When I followed the supabase support team's guidance: "if you pause & restore your project, this will upgrade the PostgREST version, many of the Postgres extensions and Postgres to version 15.
https://supabase.com/docs/guides/platform/migrating-and-upgrading-projects#upgrade-your-project
", it is really working.

Now, my project upgrade to the PostgREST version 10.1.1 and the 404 error on update do not happen.

I appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants