Skip to content

v4.3.1 - filterable and sortable functions, fixed complex ranges

Compare
Choose a tag to compare
@benjie benjie released this 24 Jan 14:17

Important note: pgInflection should not appear anywhere in your code or that of your plugins; see below. (If it does, you'll get some warning messages, but things should continue to work for the time being.)

The main feature in this release is you can now opt-in to filtering and sorting function results (so long as they return setof table type), and enabling you to filter-by and sort-by scalar computed columns. This is opt-in behaviour on a per-function basis using smart comments because if used incautiously it could result in significant performance woes (basically: in many cases database functions are black boxes to PostgreSQL, so the full function result may have to be calculated before it can then be sorted, and if it returns millions of rows that might take a moment).

Also in this release are a number of small fixes and enhancements detailed below. See the 🚨 for a fix that may impact your schema if you were relying on broken behaviour.

PostGraphile is crowd-funded, we ask the individuals and businesses that use PostGraphile to please sponsor ongoing maintenance and development.

  • functions can now be opted into filtering and sorting via @filterable and @sortable smart comments; you can also mark the result as non-nullable via @notNull smart comment (graphile/graphile-engine#378)
  • makeWrapResolversPlugin has been enhanced to allow wrapping all resolvers that match a filter function
  • makeAddInflectorsPlugin has been enhanced to allow you to access previous inflectors (e.g. if you only want to override them in certain circumstances)
  • yet more things are named via the inflector (and thus can have their names customised) including Query, Mutation and Subscription - just override the inflection.builtin(name) inflector
  • more server plugin hooks added, enabling custom logging and tweaking GraphiQL's HTML (e.g. to add dark mode)
  • accidentally passing undefined as any of PostGraphile's options now throws an error to help you more rapidly spot issues in your code (thanks @marshall007); the PostGraphile call signature has not changed
  • adds compatibility with intarray PostgreSQL extension
  • fixes formatting of PostgreSQL ranges, ranges that require extra processing (arbitrary precision numeric, bigint, timestamps) are now processed correctly (thanks @mathroc); 🚨 if you were using the broken ranges, please test related code
  • fixed typo where the CRUD plugins used pgInflection where they meant pgIntrospection; have kept the old name too to prevent this being a breaking change, but please update your plugins to use the correct name
  • the ancient inflection option to PostGraphile (which became pgInflection internally) that was deprecated in 4.0.0-beta.6 now generates warning messages if you use it, which you should not. Instead migrate to the plugin-capable inflection system
  • added additional index information to introspection in case your plugin needs that (@mlipscombe 😉 )
  • doc fixes (thanks @petetnt, @SiM07)
  • support for Windows CRLF line-breaks in smart comments