In-body chunck options in sql chunks executed interactivley get recognised but they also get included in the query causing a syntax error. Consider this example:
---
title: "Example"
output: html_document
date: "2022-07-11"
---
```{r}
library(DBI)
db = dbConnect(RSQLite::SQLite(), dbname = "sql.sqlite")
```
```{sql}
#| connection = db
SELECT 'test'
```
#> Error: unrecognized token: "#"
#> Failed to execute SQL chunk
Even if I try to creat a .sql file with the cat engine the problem is the same
```{cat}
#| engine.opts = list(file = "tbl.sql", lang = "sql")
SELECT 'test'
```
```{sql}
#| connection = db,
#| code = readLines("tbl.sql")
```
The resulting tbl.sql file has this content
#| engine.opts = list(file = "tbl.sql", lang = "sql")
SELECT 'test'
Notice how the chunk options get included, which causes a syntax error.
Is there any special consideration for using in-body chunck options interactivley with engines other than R? Or is this a bug? Kniting the document works as expected. I'm using RStudio Server 2022.07.0 Build 548