You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-- PostgreSQL.15 PostgreSQL
DECLARE @numberInteger-- Int32SET @number=3SELECT
u."Id",
u."Name",
u."Email",
u."CreatedAt"FROM"User" u
WHERE
u."Id"> :number
Such a request is not correct in syntax, i.e. when we try to execute it we get the following error: Npgsql.PostgresException: "42601: Syntax error (approximate position: "@")
A workaround was found: if you substitute a specific number/string into a linq query, then they are directly substituted into the “where”. But in real tasks, more complex data types are used (guides/dates, etc.), and this way does not work with them.
Currently linq2db is not usable for building just SQL, what you see is debug information, which executes only in SQL Server. What is the implication of generating SQL queries without execution?
I encountered the following problem:
If there is a “where” or “limit” in queries for postgres, the following queries are built:
Such a request is not correct in syntax, i.e. when we try to execute it we get the following error: Npgsql.PostgresException: "42601: Syntax error (approximate position: "@")
A workaround was found: if you substitute a specific number/string into a linq query, then they are directly substituted into the “where”. But in real tasks, more complex data types are used (guides/dates, etc.), and this way does not work with them.
Is it possible to get rid of variable declarations?
Environment details
Linq To DB
version: 5.4.1Database (with version): PostgreSQL 15
ADO.NET Provider (with version): Npgsql
Operating system: Windows 11
.NET Version: .net framework 4.8, .net 6.0
The text was updated successfully, but these errors were encountered: