Inadvertent Postgrest upgrade to v10
Incident Report for Supabase
Resolved
This incident has been resolved.
Posted Jul 07, 2023 - 10:06 UTC
Monitoring
Projects with increased error rates due to the upgrade have been rolled back.

Projects adversely affected by this change will show the following errors. If you want to be rolled back to Postgrest v9, please reach out to support

1) Because of the new one-to-one relationship detection, tables that have the structure:
```
create table countries(
id int primary key,
name text
);
create table localization(
id int REFERENCES countries UNIQUE, -- or PRIMARY KEY REFERENCES countries
timezone text
);
```

Used to respond to a request like:
```
supabase
.from('countries')
.select('*, localization(*)')
```

With the following shape:
```
[
{
"name": "Colombia",
"localization": [
{
"timezone": "America/Bogota"
}
]
}
]
```
This is now changed to:
```
[
{
"name": "Colombia",
"localization": {
"timezone": "America/Bogota"
}
}
]
```
This would cause undefined errors if your code relied on obtaining the first element of the `localization countries.localization[0]`.

2) Because of the new many-to-many relationship detection, tables that have the structure:
```
create table books (
id int primary key,
name text
);
create table authors (
id int primary key,
name text
);
create table books_authors (
book_id int references books (id),
author_id int references authors (id)
);
```

Will now cause errors on the following request:
```
supabase
.from('books')
.select('*, authors(*)')
```

The error will have the shape of:
```
{
"code":"PGRST200",
"details":"Searched for a foreign key relationship between 'books' and 'authors' in the schema 'public', but no matches were found.",
"hint":"Perhaps you meant 'books_authors' instead of 'authors'.",
"message":"Could not find a relationship between 'books' and 'authors' in the schema cache"
}
```
Posted Jul 05, 2023 - 11:33 UTC
Identified
A PostgREST upgrade was incorrectly targeted at a larger selection of projects than the projects which had opted into the upgrade. These projects were upgraded from postgrest v9.0.0 and v9.0.1 to postgrest v10. v10 comes with numerous bug fixes and performance improvements - https://postgrest.org/en/stable/releases/v10.0.0.html. Majority of the projects shouldn't see an adverse effect from the breaking changes in this upgrade - https://postgrest.org/en/stable/releases/v10.0.0.html#breaking-changes

We have identified a set of projects that have increased error rates due to this change and will downgrade them back to v9.

If your project was upgraded and want to revert back to v9, please reach out to support at https://app.supabase.com/support/new
Posted Jul 05, 2023 - 06:40 UTC