Unable to write to JSONB column
See original GitHub issueHi! Having the same issue as #432.
Can not insert value to a table with jsonb column (tried json also). Insert code looks like this:
await _db.RequestLogs.InsertAsync(() =>
new RequestLog
{
RequestBody = JsonConvert.SerializeObject(requestBody),
});
pg logs:
2019-01-13 17:44:35.723 MSK [16200] ERROR: 42804: column "request_body" is of type jsonb but expression is of type text at character 129
2019-01-13 17:44:35.723 MSK [16200] STATEMENT: INSERT INTO clear_junction.request_log
(
request_body
)
VALUES
(
$1,
)
Interesting, that it is ok to insert with constant:
await _db.RequestLogs.InsertAsync(() =>
new RequestLog
{
RequestBody = "{""Body"": ""body value""}",
});
linq2db version: 2.6.1 Database Server: PostgreSQL 11.1 Database Provider: Npgsql 4.0.4 Operating system: Windows 10 Framework version: .NET Core 2.1
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Trouble storing JSON Object into JSONB column type in ...
I have a jsonb column type in my model Place : t.jsonb :location. I have the maps API returning an object of this...
Read more >pgadmin: can't insert jsonb[] values with strings
I have jsonb[] column and it allows me to insert some nested arrays, but only with number values like {{1,2,3}, {4,5,6}, {7,8,9}} ....
Read more >Can't insert into JSONB column from string - PostgreSQL
I have the following classs defined: public class JobTask { [AutoId] public Guid Id { get; set; } public int Type { get;...
Read more >Documentation: 15: 8.14. JSON Types
The json data type stores an exact copy of the input text, which processing functions must reparse on each execution; while jsonb data...
Read more >RHEL7 Postgres doesn't support jsonb - waiverdb
Unfortunately it's not as simple as just switching it from JSONB to the older JSON column type. The JSON column type does not...
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
Actually it should work with strings. Make sure your column attribute has
DataType = DataType.BinaryJson
propertyAlso if you use T4 to generate your mappings, set
GenerateDataTypes=true;
so DataType property will be generated for you