Comments (5)
The issue is simply that the SQL query you pass to FromSql
goes through string.Format
inside EF to do parameter substitution. And for string.Format
curly braces have a special meaning - they're placeholders - so you get an exception for a malformed string.
Simply place double curly braces as an escape mechanism and all should be well (see the Escaping Braces section in this doc).
from efcore.pg.
Note: have submitted PR dotnet/efcore#5658 to add JetBrains StringFormatMethod. For users of R# etc. this will help catch this kind of error.
from efcore.pg.
Many thanks! That did solve this issue - me bad!
Cheers,
Mario
from efcore.pg.
I don't understood, what are you got at the end?
from efcore.pg.
Events.FromSql("SELECT * from events WHERE data @> '{{"$values":[{{"Resource": {{ "$type": "myType"}}}}]}}'"); ???
from efcore.pg.
Related Issues (20)
- Updating a datetime property through ExecuteUpdateAsync() forces the datetime to be UTC? HOT 4
- Look into TimescaleDB support
- Method 'get_ConstructorExpression' in type 'JsonBigIntegerReaderWriter' from assembly 'Npgsql.EntityFrameworkCore.PostgreSQL' does not have an implementation. HOT 7
- Slow performance on string contains expression. HOT 23
- Error while Querying scalar with context.Database function HOT 4
- ENUMs don't use fully qualified namespaces in ModelSnapshot which causes collisions HOT 2
- Plans for Entity Framework 9 (EF9) support? HOT 2
- Question: Correct way to rotate database credentials when using a datasource HOT 5
- Additional DateOnly related translation
- Missing checks for predicate when simplifying primitive collections
- Translation error when storing NodaTime `(Instant, TimeZoneId)` and filtering on local date time values HOT 1
- Add support for foreign key match types (FULL, PARTIAL, SIMPLE) HOT 3
- JsonPolymorphic support HOT 1
- Unable to create a 'DbContext' of type 'ApplicationDbContext' While trying to create migrations npgsql HOT 5
- Unable to configure separate migrations assembly when setting up Aspire HOT 2
- Group by entity with xmin/xid concurrency token throws
- Arrays of type with value converter fail in query generation HOT 4
- Is it possible to connect to multiple databases in a multitenant scenario? HOT 4
- "bad protocol version" error when connecting to PostgreSQL HOT 3
- Look into IS DISTINCT FROM as an alternative to nullability semantics compensation HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from efcore.pg.