oguimbal / pg-mem

An in memory postgres DB instance for your unit tests

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow table name prefixed with schema

stathismor opened this issue · comments

I want to be able to prefix the table of my query, with a schema, using the pg adapter.

Context
Let's say there is function in my codebase that accepts a schema does something like:

query({ 
  text: `SELECT *
         FROM schema.user
         WHERE id = $1::uuid`,
   values: [id]
})

I want to be able to use pg-mem and pass the the pg adapter's query in order to test it, but keep the query text as is. Currently, I cannot find a way that pg adapter accepts the table prefixed with the schema like that.

I also tried something like SELECT * from current_schema().user but this does not seem to be supported either.