Skip to content
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

Refactors and fixes for schema cache #3644

Merged
merged 15 commits into from
Jul 9, 2024

Commits on Jul 9, 2024

  1. fix: Make --dump-schema work with in-database pgrst.db_schemas setting

    This needs to be loaded from in-database configuration first, otherwise
    the dump-schema output will be for the default (public) schema.
    wolfgangwalther committed Jul 9, 2024
    Configuration menu
    Copy the full SHA
    a437446 View commit details
    Browse the repository at this point in the history
  2. fix: Show number of loaded timezones in log output

    There is no reason to hide those, right?
    wolfgangwalther committed Jul 9, 2024
    Configuration menu
    Copy the full SHA
    cf0b8f0 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    67548a9 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    b940581 View commit details
    Browse the repository at this point in the history
  5. refactor: Remove useless DISTINCT

    There is already a GROUP BY in the same SELECT.
    wolfgangwalther committed Jul 9, 2024
    Configuration menu
    Copy the full SHA
    1b8bea6 View commit details
    Browse the repository at this point in the history
  6. refactor: Remove redundant conditions in schema cache

    Those conditions are covered by the respective nspname = ANY branches.
    wolfgangwalther committed Jul 9, 2024
    Configuration menu
    Copy the full SHA
    e3ba0fb View commit details
    Browse the repository at this point in the history
  7. refactor: Use ::regnamespace casts instead of comparing schemas by name

    Casting pg_catalog to regnamespace is slightly more efficient, because
    the comparison will be oid-based, not text-based.
    wolfgangwalther committed Jul 9, 2024
    Configuration menu
    Copy the full SHA
    85726ae View commit details
    Browse the repository at this point in the history
  8. refactor: Make schema cache dumps more predictable with consistent ORDER

    This helps diffing schema cache changes during development.
    wolfgangwalther committed Jul 9, 2024
    Configuration menu
    Copy the full SHA
    26b93f4 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    f75e5c9 View commit details
    Browse the repository at this point in the history
  10. refactor: Replace pg_namespace joins with ::regnamespace in schema cache

    Less joins are much easier to read and understand.
    wolfgangwalther committed Jul 9, 2024
    Configuration menu
    Copy the full SHA
    dbef7cd View commit details
    Browse the repository at this point in the history
  11. fix: List correct enum options when multiple types with same name are…

    … present
    
    The schema cache and OpenAPI output would currently list the first found
    enum with the same name instead of the correct type. One other case
    where this comes up is when a regular type and an enum type have the
    same name. For example in the spec fixtures, we have an enum called
    "bit". Every "bit" type, no matter whether it's that enum or the
    built-in bit type, will show those enum options in the OpenApi output.
    
    Not adding a test, because OpenAPI is supposed to go away in the future
    anyway.
    wolfgangwalther committed Jul 9, 2024
    Configuration menu
    Copy the full SHA
    dbd48c5 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    617124c View commit details
    Browse the repository at this point in the history
  13. refactor: Simplify funcsSqlQuery

    This allows to re-use ANY($$1) in the next commit.
    wolfgangwalther committed Jul 9, 2024
    Configuration menu
    Copy the full SHA
    724b6c5 View commit details
    Browse the repository at this point in the history
  14. feat: Fail schema cache lookup with invalid db-schemas config

    Previously, we'd silently report "200 OK" on the root endpoint, but
    would never return any endpoints from the schema cache.
    
    Now the schema cache query fails because of the ::regnamespace cast.
    wolfgangwalther committed Jul 9, 2024
    Configuration menu
    Copy the full SHA
    b6863f1 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    67385de View commit details
    Browse the repository at this point in the history