# Using FunSQL.jl with Postgres.jl

**URL:** <https://discourse.julialang.org/t/using-funsql-jl-with-postgres-jl/139564>\
**Category:** Data\
**Created:** [September 19, 2026, 2:29pm UTC](https://discourse.julialang.org/t/using-funsql-jl-with-postgres-jl/139564 "2026-09-19T14:29:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jake](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jake/32/46007_2.png) [@Jake](https://discourse.julialang.org/u/Jake)\
**Post date:** [September 19, 2026, 2:29pm UTC](https://discourse.julialang.org/t/using-funsql-jl-with-postgres-jl/139564/1 "2026-09-19T14:29:02Z")

</div>

I am testing Postgres.jl with my package that currently uses LibPQ and FunSQL.

The testing so far which did not include FunSQL worked well. I am getting stuck on the FunSQL integration. LibPQ.jl does not support the DBInterface.jl package, so there was a workaround explained in the [FunSQL documentation](https://mechanicalrabbit.github.io/FunSQL.jl/stable/examples/#Database-connection-with-LibPQ.jl). I expect that this is not required with Postgres.jl since it does support DBInterface.

The [FunSQL documentation](https://mechanicalrabbit.github.io/FunSQL.jl/stable/guide/#Using-FunSQL), gives the example:

`using FunSQL`  
`using SQLite`  
`conn = DBInterface.connect(FunSQL.DB{SQLite.DB}, DATABASE)`

When I try to duplicate this for Postgres, `Postgres.DB` is not recognized. My current question is what should go into the curly braces in the command below:

```julia-auto
using Postgres, DBInterface, FunSQL

conn = DBInterface.connect(FunSQL.DB{Postgres.DB},
"host=$dbhost port=$dbport dbname=$dbread user=$DATABASE_USER password=$DATABASE_PASSWORD")

```

---

<div class="post-metadata">

**Author:** ![quinnj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/quinnj/32/11_2.png) [@quinnj](https://discourse.julialang.org/u/quinnj)\
**Post date:** [September 24, 2026, 4:45pm UTC](https://discourse.julialang.org/t/using-funsql-jl-with-postgres-jl/139564/3 "2026-09-24T16:45:07Z")

</div>

Postgres.jl’s connection type is `Postgres.Connection` (there’s no `Postgres.DB`), and it implements DBInterface directly, so you don’t need the LibPQ bridging code from the FunSQL docs.

One catch: FunSQL detects the SQL dialect from the connection type, and it doesn’t know about `Postgres.Connection`yet. Without a dialect you’ll get `cannot infer SQLDialect from the connection type`. For now, pass the dialect yourself:

```julia-auto
using Postgres, DBInterface, FunSQL

conn = DBInterface.connect(FunSQL.DB{Postgres.Connection},
    "host=$dbhost port=$dbport dbname=$dbread user=$DATABASE_USER password=$DATABASE_PASSWORD";
    dialect = :postgresql)

```

After that, `DBInterface.execute(conn, q; params...)` works as usual.

I can probably open a small PR to FunSQL to add `Postgres.Connection`, so `dialect = :postgresql` won’t be needed.
