Skip to content

Conversation

steve-chavez
Copy link
Member

@steve-chavez steve-chavez commented Oct 22, 2025

Closes #4364 by reverting 86c3257

As discussed on #4364, 86c3257 generates several problems:

  1. We diverge from database as source of truth because once a schema is dropped, it's not automatically removed from db-schemas and then postgREST fails. Reducing its reliability.
  2. We diverge from PostgreSQL search_path lenient behavior:
set search_path to anything, here, even, nonexistent; -- this doesn't fail
  1. Schema-based multitenancy becomes more complicated because of 1.

There are no noticeable gains from 86c3257:

  • No gains in performance for the schema cache queries.
  • No user report about it ever being a problem. In fact the leniency was a feature.

Implementation details

Essentially it removes the $1::regnamespace[] casting for db-schemas that was introduced on 86c3257

Closes PostgREST#4364 by reverting 86c3257

As discussed on PostgREST#4364, 86c3257
generates several problems:

1)We diverge from database as source of truth because once a
  schema is dropped, it's not automatically removed from `db-schemas`
  and then postgREST fails.
2)We diverge from PostgreSQL `search_path` lenient behavior:
```sql
set search_path to anything, here, even, nonexistent; -- this doesn't fail
```
3)schema-based multitenancy becomes more complicated because of 1.

There are no noticeable gains from 86c3257:

- No gains in performance for the schema cache queries.
- No user report about it ever being a problem. In fact the leniency was
  a feature.
@steve-chavez steve-chavez marked this pull request as ready for review October 22, 2025 01:55
@wolfgangwalther
Copy link
Member

I don't have the energy to fight about this, so I won't block you, but I also won't approve a change that I think is fundamentally wrong.

  1. We diverge from database as source of truth because once a schema is dropped, it's not automatically removed from db-schemas and then postgREST fails

This is just backwards. With this change, the schema cache becomes the source of truth. Schema still in the schema cache? You get a 200 OK. That's not the database as the source of truth.

@wolfgangwalther wolfgangwalther removed their request for review October 22, 2025 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Auto-removal of schemas in db-schemas once DROP SCHEMA .. is done

2 participants