Doobie: create constant table with values

Viewed 135

Postgres allows creation of constant tables for use in queries with this syntax:

WITH names (id, name) AS (VALUES (1, 'ABC'), (2, 'BCD')) 
  SELECT id FROM names

or the inlined version:

SELECT id FROM (VALUES (1, 'ABC'), (2, 'BCD')) AS t (id, name);

assuming I have an instance of a Meta[T] for T a case class, is there a way of writing a generic function that takes List[T] and creates me a table of T values.

0 Answers
Related