sqlkata / querybuilder

SQL query builder, written in c#, helps you build complex queries easily, supports SqlServer, MySql, PostgreSql, Oracle, Sqlite and Firebird
https://sqlkata.com
MIT License
3.06k stars 499 forks source link

Fails to update jsonb field #673

Closed mesgar closed 1 year ago

mesgar commented 1 year ago

Exception: Npgsql.PostgresException: 42804: column "message" is of type jsonb but expression is of type text

Code: json = new {message = JsonConvert.SerializeObject(data)}; affected = db.Query("xxxxx").Where(whereLeft, whereRight).Update(json);

SQL: The query runs fine by itself.

image

Npgsql Version: 7.0.4 SQLKata Version: 2.4.0

🙏

mesgar commented 1 year ago

This answer did the trick!

for now you can use the db.Statement method

🙏