Accessing composite types #487
-
PostgreSQL supports syntax for extracting fields from composite types. https://www.postgresql.org/docs/current/rowtypes.html#ROWTYPES-ACCESSING Here's a toy example: SELECT (foos).field from (select foos from foos) f Since the parens are significant here, how would you recommend access this field? This works, but it uses (-> (select [[:raw [[:composite :foos]] ".field"]])
(from [(-> (select :foos) (from :foos)) :f])) which results in something functional and close to the example after formatting: SELECT ((foos)).field FROM (SELECT foos FROM foos) AS f Is there a better way to do this? Normally one would use a namespaced keyword, but it won't work here. Thanks for your help! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Support for this was added in 2.4.1002 (early March) -- see #474 |
Beta Was this translation helpful? Give feedback.
-
Thank you! I actually implemented this dot function myself, glad to see it's already present! |
Beta Was this translation helpful? Give feedback.
See https://cljdoc.org/d/com.github.seancorfield/honeysql/2.4.1026/doc/getting-started/sql-special-syntax-#dot- in the documentation.