This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-05-15
Channels
- # announcements (20)
- # babashka (281)
- # beginners (13)
- # biff (8)
- # calva (20)
- # cider (5)
- # clj-commons (1)
- # clojure (46)
- # clojure-boston (1)
- # clojure-europe (6)
- # clojure-losangeles (24)
- # clojuredesign-podcast (3)
- # clojurescript (12)
- # datomic (1)
- # events (1)
- # fulcro (12)
- # guix (2)
- # honeysql (1)
- # integrant (1)
- # introduce-yourself (1)
- # rdf (16)
- # reagent (3)
- # reitit (14)
- # releases (3)
- # sci (28)
- # shadow-cljs (122)
- # specter (1)
- # tools-deps (10)
- # xtdb (6)
Hi everyone, is there a way in honey
and psqlh
that I could do these two queries in a single statement - assuming these are my tables user (id, login, password, name)
and dealer (id, user_id)
:
WITH rows AS (
INSERT INTO "user"
(login, password, name)
VALUES
('dealer1', 'jygbjybk', 'Dealer 1')
RETURNING id
)
INSERT INTO dealer (user_id)
SELECT id
FROM rows;
SELECT currval('dealer_id_seq');
I want to insert in the user table and use the returning id from that to insert the dealer in one statement.
Were using honeysql from versions prior to 2.
Thanks