Skip to content

Fully qualified relation and function names #4240

@mkleczek

Description

@mkleczek

Problem

Right now PostgREST requires configuration of db-schemas to expose database schemas. It also requires setting PostgREST specific headers in the request to select a schema if there are more than one configured in db-schemas. There were some ideas on how to make it more flexible, eg #2783. Suggestions on changing URI format and include schema name in path were rejected as not backwards compatible.

Solution

Accept fully qualified relation and function names, eg:

http://localhost:8000/cinema.films (SELECT * FROM cinema.films)
http://localhost:8000/rpc/app1.fun1(5) (SELECT * FROM app1.fun1(5))
http://localhost:8000/cinema.films?select=people.directors (Fully qualified computed relationship)

There would need to be some disambiguating done to handle relation/function names containing periods (like /rpc/index.html). To maintain backwards compatibility, names in a schema selected for current request from configured db-schemas should have precedence over fqns.

That would allow getting rid of db-schemas config altogether in the future (and would probably require configuration of db-excluded-schemas with default value public,pg_catalog,information_schema).

Metadata

Metadata

Assignees

No one assigned

    Labels

    ideaNeeds of discussion to become an enhancement, not ready for implementation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions