Slick issue when going with PostgreSQL Slick issue when going with PostgreSQL postgresql postgresql

Slick issue when going with PostgreSQL


In the end I was able to solve this issue.

I specify the table name only:

object Addresses extends Table[Address]("address")

and change my postgresql conf to include my schema when searching (it seems that slick is looking on public schema only):

search_path = '"$user",assetxs,public'

and now it works.


You've put the schema into the table name. A (quoted) table name containing a dot character is valid in SQL but it's not what you want here. You have to specify the schema separately:

object Addresses extends Table[Address](Some("assetxs"), "address")


The solution I found when wanting to work with both H2 (testing) and Postgres (production) using liquibase and slick.

  • Stick with lowercase in your Slick Table objects

class MyTable(tag: Tag) extends Table[MyRecord](tag, Some("my_schema"), "my_table")

  • In your H2 url config you'll need to specify DATABASE_TO_UPPER=false (this prevents the table and column names from being upper cased) and put quotation marks around the INIT schema (this prevents the schema from being upper cased)

url = jdbc:h2:mem:test;MODE=PostgreSQL;DATABASE_TO_UPPER=false;INIT=create schema if not exists \"my_schema\"\;SET SCHEMA \"my_schema\""

  • When specifying schema names in liquibase scripts it must also be quoted so that H2 won't try to capitalize it.