 <p>Your <code>select</code> is not doing what you think it does. </p> <p>The most compact version in PostgreSQL would be something like this:</p> <pre><code>with data(first_name, last_name, uid) as ( values ( 'John', 'Doe', '3sldkjfksjd'), ( 'Jane', 'Doe', 'adslkejkdsjfds') ) insert into users (first_name, last_name, uid) select d.first_name, d.last_name, d.uid from data d where not exists (select 1 from users u2 where u2.uid = d.uid; </code></pre> <p>Which is pretty much equivalent to:</p> <pre><code>insert into users (first_name, last_name, uid) select d.first_name, d.last_name, d.uid from ( select 'John' as first_name, 'Doe' as last_name, '3sldkjfksjd' as uid union all select 'Jane', 'Doe', 'adslkejkdsjfds' ) as d where not exists (select 1 from users u2 where u2.uid = d.uid; </code></pre>