Fork me on GitHub
#honeysql
<
2022-02-24
>
rafaeldelboni14:02:10

Hey we are using postgresql's https://www.postgresql.org/docs/14/ddl-inherit.html and I would like to extend honey to add the keywork ONLY to make selects like SELECT * FROM ONLY table_name What is the best approach? This is what I did;

(def format-selects-common #'sql/format-selects-common)

(defn- format-selects [k xs]
  (format-selects-common
   (sql/sql-kw k)
   'from
   xs))

(sql/register-clause! :from-only format-selects :where)

(sql/format {:select [:*], :from-only [[:table :t]]})

seancorfield15:02:03

@rafaeldelboni Happy to add core support for that -- can you a) create an issue on GitHub with this example and b) include a link to the relevant PostgreSQL docs so I can read more about the syntax (and any subtleties of it). Thanks

seancorfield15:02:29

Just got the GH email -- thank you!