Skip to content

Latest commit

 

History

History
28 lines (18 loc) · 527 Bytes

2019-04-19_psql_returning.md

File metadata and controls

28 lines (18 loc) · 527 Bytes

PSQL Returning

04/19/2019

Normally when you insert a record in postgres, the query returns something like the following:

insert into users(email) values ('[email protected]') returning *;
INSERT 0 1

You get a preview of the objects inserted by using the returning keyword.

insert into users(email) values ('[email protected]') returning *;
     email
---------------
 john@test.com
(1 row)

INSERT 0 1

H/T Mary Lee for showing this off on a Friday Show and Tell

Tags: psql, Returning, PostgreSQL