squeal-postgresql-qq: QuasiQuoter transforming raw sql into Squeal expressions.

[ library, mit, unclassified ] [ Propose Tags ] [ Report a vulnerability ]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.1.1.0, 0.1.1.1, 0.1.2.0, 0.1.2.1
Dependencies aeson (>=2.1.2.1 && <2.3), base (>=4.18.3.0 && <4.22), bytestring (>=0.11.3.0 && <0.13), generics-sop (>=0.5.1.3 && <0.6), postgresql-syntax (>=0.4 && <0.5), squeal-postgresql (>=0.9.1.3 && <0.10), template-haskell (>=2.20.0.0 && <2.24), text (>=1.2.5.0 && <2.2), time (>=1.9.3 && <1.15), uuid (>=1.3.15 && <1.4) [details]
License MIT
Copyright 2022 Rick Owens
Author Rick Owens
Maintainer rick@owensmurray.com
Home page https://github.com/owensmurray/squeal-postgresql-qq
Uploaded by rickowens at 2025-07-11T02:42:59Z
Distributions
Downloads 20 total (14 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]

Readme for squeal-postgresql-qq-0.1.0.0

[back to package description]

squeal-postgresql-qq

This library provides a Template Haskell quasiquoter parsing SQL as the quoted language and producing corresponding squeal-postgresql expressing. The goal is to provide an easier way to use the squeal-postgresql library, by eliminating (or at least reducing) the need for the user to learn the squeal "DSL" and allowing her to write regular SQL instead.

Stability

I would give this package a 5 out of 10 for stability where 0 is completely unstable and experimental and 10 is maybe like the aeson package.

I think I've got a very large and usable segment of SQL supported but of course there are unsupported features that are kind of important such as common table expressions.

I don't foresee backwards incompatable changes being a problem because, after all, the "interface" is mostly the SQL language, which is stable. Most work will be about supporting new corners of SQL.

In terms of maintenance, I intend to be responsive to any bugs and to keep up to date with the latest dependencies and GHC versions. In other words, this is a maintained package, even if I experience a lull in adding new supported SQL features.

Production usage

I would feel relatively comfortable using this in production. The risk regarding stability/maintenance is pretty low.

If you have queries that are supported, great! They'll continue to be supported. If you have a query that is not supported, you can always fall back to crafting squeal expressions manually. (File an issue! I'll prioritize real-world usage.)

If you have a supported SQL statement that you find you have to modify in a way that makes it unsupported, you can always tell GHC to -ddump-splices and use the quasi-quoter generated squeal as a starting point for your modifications.

How to use this library.

See the haddocks.

Most important features not currently implemented

  • Prepared statement parameters
    • See the haddock documentation for how to get haskell values into your sql statements.
  • WITH clauses (Common Table Expressions)
  • ON CONFLICT clause

Other features is not currently implemented

(Generated by an LLM. Maybe not complete.)

  • TABLESAMPLE clause
  • ONLY keyword for table inheritance
  • WINDOW clause and window functions (OVER)
  • INTO clause (SELECT ... INTO ...)
  • LIKE with ESCAPE
  • IN with a subquery
  • OPERATOR() syntax
  • Parameter indirection (e.g., $1[i])
  • Indirection on parenthesized expressions (e.g., (expr)[i])
  • Aggregate FILTER clause
  • WITHIN GROUP clause
  • DISTINCT in function arguments
  • ORDER BY in function arguments
  • Function name indirection (e.g., schema.func)
  • SETOF type modifier
  • BIT and BIT VARYING types
  • INTERVAL with qualifiers
  • Types with precision/scale (TIMESTAMP, TIME, FLOAT, NUMERIC, etc.)
  • Qualified type names (e.g., schema.my_type)
  • CURRENT_TIMESTAMP with precision
  • Multidimensional arrays with explicit bounds
  • ORDER BY USING
  • FOR READ ONLY locking clause
  • Advanced GROUP BY features (GROUPING SETS, CUBE, ROLLUP)
  • Multi-row VALUES clause
  • OVERRIDING clause for identity columns
  • Column indirection in INSERT target lists
  • WHERE CURRENT OF for cursors
  • Complex relation expressions in UPDATE or DELETE targets
  • Column indirection in UPDATE SET clauses