Blob issue with entity framework 5
See original GitHub issueI am getting this exception upon initial entity framework migration of my postgres db:
Error Exception: Npgsql.PostgresException (0x80004005): 42704: type "blob" does not exist
at Npgsql.NpgsqlConnector.<ReadMessage>g__ReadMessageLong|194_0(NpgsqlConnector connector, Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage)
at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken)
at Npgsql.NpgsqlDataReader.NextResult()
at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken)
at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken)
at Npgsql.NpgsqlCommand.ExecuteNonQuery(Boolean async, CancellationToken cancellationToken)
at Npgsql.NpgsqlCommand.ExecuteNonQuery()
Here is my create script:
table.Column<byte[]>(maxLength: 16, nullable: false),
b.Property<byte[]>("BytesColumn")
.IsRequired()
.HasColumnType("BLOB")
.HasMaxLength(16);
Is there nothing that changes blob to bytea?
Changing the “BLOB” entries to “bytea” does not fix the issue.
Using latest version of the nuget as os 2021-03-16.
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Entity Framework Core traverse big blob data without ...
I'm writing code that's traversing big amounts of picture data, preparing a big delta block containing it all compressed for sending. Here's a ......
Read more >Performance considerations for EF4, EF5, and EF6
2 Performance issues when the object cache has many entities. The object cache helps to increase the overall responsiveness of Entity Framework.
Read more >7.1 Entity Framework 6 Support
MySQL Connector/NET integrates support for Entity Framework 6 (EF6), which now includes support for cross-platform application deployment with the EF 6.4 ...
Read more >Using Large Character or Binary Data Types
This annotation will force a BLOB column to be created. [Column("BLOB_COLUMN", TypeName = "BLOB")] public byte[] BYTE_TYPE { get; set; }.
Read more >ASP.NET Core – Azure Blob Storage – Repository Pattern
The purpose of this document is to describe the steps necessary to create a development environment for using Azure Blob Storage using the ......
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
@jjxtra data types simply aren’t the same across database; it’s not just a question of blob vs. bytea - SQL Server has
nvarchar
whereas PostgreSQL hastext
. It doesn’t make any sense to make the PostgreSQL migrations provider recognize all data types of all other database…Note also that there are various other differences between databases - not just data type names - which also affect migrations. So this approach wouldn’t work in the general case.
Please take a look at the docs I linked to above on managing migrations and multiple databases. You typically need to generate each migration for your different supported databases.
I am changing
blob
tobytea
so that I don’t have to maintain a sqlite and postgres migration, as I mentioned earlier, every other sqlite datatype is compatible with postgres, so having this one line of code added would be nice, even if it’s not officially postgres standard. All my tests use sqlite, and production servers use postgres.