Analyzer doesn't seem to detect referenced literal queries in nested modules in fsx files
See original GitHub issueDescribe the bug I followed the setup for the analyzer in ionide, windows 10 and net5, but I cannot make it work…
if i change the db name the analyzer complains, so he is alive (?) but he cannot check issues with db columns…

docker run --name localdb -e POSTGRES_PASSWORD=password -d -p 5432:5432 postgres
in postgres i then run this
CREATE SCHEMA test;
CREATE TABLE test.articles (
id BIGINT PRIMARY KEY NOT NULL, --could be string to be extensible
art_name CITEXT UNIQUE NOT NULL, --creates unique index
stock BIGINT NOT NULL
);
i installed pgsql analyzer (see sql errors at edit time) at root of where the .fsx file is
dotnet tool install --global Paket
paket init
paket add NpgsqlFSharpAnalyzer --group Analyzers
and the NPGSQL_FSHARP file (which seems to work as wrong connection triggers)
Host=localhost; Username=postgres; Password=password; Database=postgres
i also tried to run Ubik on the file, but it reports no error, while the column name x does not exist in practice.
To Reproduce
#r "nuget:Npgsql.FSharp"
#r "nuget:FSharp.Data"
open FSharp.Data
open FSharp.Core
module Constants =
[<Literal>]
let sqlDevConnection = "Host=localhost;Database=postgres;Username=postgres;Password=password"
//sensitive data should be injected from environment
System.Environment.SetEnvironmentVariable("DATABASE_CONNECTION_STRING", Constants.sqlDevConnection)
module Domain =
type Article = {
Id : int ;
Name: string;
Stock: int
}
module Data =
open ProvidedTypes
open Domain
open Npgsql.FSharp
module Queries =
[<Literal>]
let getArticles =
"SELECT x \n\
FROM test.articles"
let getConnectionString () =
System.Environment.GetEnvironmentVariable "DATABASE_CONNECTION_STRING"
let getArticles () =
getConnectionString()
|> Sql.connect
|> Sql.query Queries.getArticles
|> Sql.execute (fun read ->
{
Id = read.int "id"
Name = read.text "art_name"
Stock = read.int "stock"
})
Expected behavior Should underline the non existing column X and give a warning
Screenshots



Desktop (please complete the following information):
- OS: Windows 10 also tried WSL ubuntu
- NET5 sdk
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Issues · Zaid-Ajaj/Npgsql.FSharp.Analyzer
F# analyzer that provides embedded SQL syntax analysis, type-checking for ... Analyzer doesn't seem to detect referenced literal queries in nested modules ......
Read more >The Problem with F# Evangelism
I recently wrote a C# report integration service - it was a C# service that connected to a DB at specific time intervals,...
Read more >The F# 4.1 Language Specification
Note: thi does not yet incorporate the RFCs for F# 4.1, see ... syntax is the default for all F# code in files...
Read more >GCHP - Release 14.1.1 GEOS-Chem Support Team
The GCHP repository has submodules (other repositories that are nested inside the GCHP repository) that aren't.
Read more >Untitled
Isiticili kirpik kivirici, Fadas da barbie, Crayola mini-twistables crayons 10pk, Anchetatorul colecteaza, String literal does not match?
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Hi there @jkone27 thanks for filing the issue. My initial thoughts is that the analyser isn’t able to detect the referenced query using the fully qualified name Queries.getArticles. can you try just getArticles without the full module? Or simply use an inline query string to see If that fixes the issue?
I will give this a try later and will let you know how it goes
Since this is quite difficult to implement, it is easier to just not use nested modules in fsx queries and to keep things simple