# Fts extension in DuckDB doesn't work

**URL:** https://discourse.julialang.org/t/fts-extension-in-duckdb-doesnt-work/118125
**Category:** General Usage
**Tags:** question, duckdb
**Created:** [August 13, 2024, 9:24am UTC](https://discourse.julialang.org/t/fts-extension-in-duckdb-doesnt-work/118125 "2024-08-13T09:24:48Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![TimG](https://avatars.discourse-cdn.com/v4/letter/t/82dd89/32.png) [@TimG](https://discourse.julialang.org/u/TimG)
#### Post date: [August 13, 2024, 9:24am UTC](https://discourse.julialang.org/t/fts-extension-in-duckdb-doesnt-work/118125/1 "2024-08-13T09:24:48Z")

</div>

The fts extension in DuckDB is finally installed on my windows machine after [much appreciated help](https://discourse.julialang.org/t/cannot-install-fts-extension-in-duckdb/117996).  
The first thing I need to do to use this extension is create an fts index.  
Following the docs for this extension, I tried:

```julia
    DBInterface.execute(con, "PRAGMA create_fts_index('combined', 'UPRN', 'combo');")

```

but I get this error:

```julia
ERROR: LoadError: DuckDB.QueryException("Invalid Input Error: Cannot prepare multiple statements at once!")

```

Google found the same error message in [this existing DuckDB issue](https://github.com/duckdb/duckdb/issues/1100) relating to the Python DuckDB client. The answer given stated:

> This seems to be an error with the Python client not being able to handle multiple statements in the same call to execute.

Is this also an issue for the Julia client? Is it possible to get fts to work?

---

<div class="post-metadata">

### Author: ![frankier](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/frankier/32/35101_2.png) [@frankier](https://discourse.julialang.org/u/frankier)
#### Post date: [August 13, 2024, 10:20am UTC](https://discourse.julialang.org/t/fts-extension-in-duckdb-doesnt-work/118125/2 "2024-08-13T10:20:49Z")

</div>

You could try with [Home · DBInterface.jl](https://juliadatabases.org/DBInterface.jl/dev/#DBInterface.executemultiple)

This does seem unfortunate that this pragma creates multiple statements and doesn’t insulate the user from it given it looks like a single statement. It might qualify as a leaky abstraction and therefore bug in the FTS extension.

---

<div class="post-metadata">

### Author: ![frankier](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/frankier/32/35101_2.png) [@frankier](https://discourse.julialang.org/u/frankier)
#### Post date: [August 13, 2024, 10:22am UTC](https://discourse.julialang.org/t/fts-extension-in-duckdb-doesnt-work/118125/3 "2024-08-13T10:22:45Z")

</div>

Actually it looks like it was reported and fixed here: [`PRAGMA create_fts_index(…)` doesn't work in Julia package · Issue #10892 · duckdb/duckdb · GitHub](https://github.com/duckdb/duckdb/issues/10892)

Are you using a version that contains the purported fix?

---

<div class="post-metadata">

### Author: ![frankier](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/frankier/32/35101_2.png) [@frankier](https://discourse.julialang.org/u/frankier)
#### Post date: [August 13, 2024, 10:24am UTC](https://discourse.julialang.org/t/fts-extension-in-duckdb-doesnt-work/118125/4 "2024-08-13T10:24:19Z")

</div>

Looks like you need to use `DuckDB.query`

```julia

"""
Executes a SQL query within a connection and returns the full (materialized) result. 
The query function is able to run queries with multiple statements, unlike `DBInterface.execute`(@ref) which is only able to prepare a single statement.
"""
function query(con::DuckDB.Connection, sql::AbstractString)

```

---

<div class="post-metadata">

### Author: ![TimG](https://avatars.discourse-cdn.com/v4/letter/t/82dd89/32.png) [@TimG](https://discourse.julialang.org/u/TimG)
#### Post date: [August 13, 2024, 11:28am UTC](https://discourse.julialang.org/t/fts-extension-in-duckdb-doesnt-work/118125/5 "2024-08-13T11:28:40Z")

</div>

Thank you @frankier.
