Is it possible to return an entire row with :return-execute?
little-dude opened this issue · comments
little-dude commented
Hi,
I'm using postgresql, and I use INSERT ... RETURNING
so that when a row is inserted, it is returned. For instance:
example=# insert into users (first_name, last_name, phone, want_messages) values ('foo', 'bar', 'baz', true) returning *;
id | first_name | last_name | phone | want_messages
----+------------+-----------+-------+---------------
20 | foo | bar | baz | t
(1 row)
INSERT 0 1
From the documentation, all the examples of :return-execute
I found are for returning just the id of the inserted row, and it seems it does not support returning the entire row:
-- :name create-user! :! :<!
-- :doc creates a new user record a return the inserted row
INSERT INTO
users
(first_name, last_name, phone, want_messages)
VALUES
(:first_name, :last_name, :phone, :want_messages)
RETURNING
*
example.db.core => (create-user! {:first_name "a" :last_name "b" :want_messages false :phone "c"})
(0)
Am I doing something wrong, or is this not possible?
little-dude commented
Oh I just understood that I have to choose between :!
and :<!
actually. Removing :!
works. Sorry for the noise.