# Interface FunSQL with LibPQ using DBInterface

**URL:** https://discourse.julialang.org/t/interface-funsql-with-libpq-using-dbinterface/99635
**Category:** General Usage
**Tags:** package
**Created:** [May 30, 2023, 10:35pm UTC](https://discourse.julialang.org/t/interface-funsql-with-libpq-using-dbinterface/99635 "2023-05-30T22:35:01Z")
**Posts on this page:** 1
**Showing post:** 8

<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: [January 14, 2025, 7:07pm UTC](https://discourse.julialang.org/t/interface-funsql-with-libpq-using-dbinterface/99635/8 "2025-01-14T19:07:29Z")

</div>

The code posted [here](https://discourse.julialang.org/t/interface-funsql-with-libpq-using-dbinterface/99635/6) works fine and without error when used from the REPL.

In my use case I have a package MyPackage with the Module also called MyPackage that includes a submodule called MySubModule. MySubModule uses this code through an include statement. When I try to precompile my package it fails with the error shown below, but it executes fine. I suspect that the PR referred to by @TheCedarPrince means I don’t need all this code but have not been able to sort out what I need to do.

```julia
julia> using MyPackage
Precompiling MyPackage...
Info Given MyPackage was explicitly requested, output will be shown live
WARNING: Method definition connect(Type{LibPQ.Connection}, Any...) in module LibPQ at C:\Users\jakez\.julia\packages\LibPQ\i4yBe\src\dbinterface.jl:5 overwritten in module MySubModule at C:\Users\jakez\.julia\dev\MyPackage\src\general\FunPQ.jl:13.
ERROR: Method overwriting is not permitted during Module precompilation. Use ` __precompile__ (false)` to opt-out of precompilation.
  ? MyPackage
[Info: Precompiling MyPackage[8dcd7bc5-9351-4069-b6f5-927426629c70] (cache misses: include_dependency fsize change (8))
WARNING: Method definition connect(Type{LibPQ.Connection}, Any...) in module LibPQ at C:\Users\jakez\.julia\packages\LibPQ\i4yBe\src\dbinterface.jl:5 overwritten in module Mcc172Acquire at C:\Users\jakez\.julia\dev\MyPackage\src\general\FunPQ.jl:13.
ERROR: Method overwriting is not permitted during Module precompilation. Use ` __precompile__ (false)` to opt-out of precompilation.
┌ Info: Skipping precompilation due to precompilable error. Importing MyPackage [8dcd7bc5-9351-4069-b6f5-927426629c70].
└ exception = Error when precompiling module, potentially caused by a __precompile__ (false) declaration in the module.

julia>

```

When I comment out the code below the `using LibPQ` statement, MyPackage precompiles but does not execute giving this error.

```julia
julia> foo()
ERROR: MethodError: no method matching connect(::Type{LibPQ.Connection}, ::String)
The function `connect` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  connect(::Type{FunSQL.SQLConnection{RawConnType}}, ::Any...; schema, dialect, cache, kws...) where RawConnType
   @ FunSQL C:\Users\jakez\.julia\packages\FunSQL\FhUx7\src\connections.jl:77

Stacktrace:
 [1] connect(::Type{FunSQL.SQLConnection{…}}, args::String; schema::Nothing, dialect::Nothing, cache::Int64, kws::@Kwargs{})
   @ FunSQL C:\Users\jakez\.julia\packages\FunSQL\FhUx7\src\connections.jl:82
 [2] connect(::Type{FunSQL.SQLConnection{LibPQ.Connection}}, args::String)
   @ FunSQL C:\Users\jakez\.julia\packages\FunSQL\FhUx7\src\connections.jl:77

```

The [FunSQL documentation](https://mechanicalrabbit.github.io/FunSQL.jl/stable/examples/) indicates that I still need the commands that won’t precompile.

I am not able to figure out what I should be doing to allow precompilation. Help is appreciated.

---

_[View the full topic](https://discourse.julialang.org/t/interface-funsql-with-libpq-using-dbinterface/99635)._
