Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Reports that use derived tables can be rewritten to use CTEs (Common Table Expression), such as the CTE at the top of this user_permission_sets.sql query:

WITH permissions_users AS (
SELECT
jsonb_array_elements_text(jsonb->'permissions') AS user_permissions,
jsonb_extract_path_text(jsonb, 'userId')::uuid AS user_id
FROM
folio_permissions.permissions_users
)

See the Chapter on CTEs in the cookbook for more information:

...