Comments (3)
I'm not sure why a RenameColumn operation is getting generated there in the migration - that shouldn't be the case; there's no actual change on the database side here, since xmin
is a system column that always has that name and cannot be renamed (as the error message says).
You should be able to just remove the RenameColumn operation from the scaffolded migration and work as usual; to fully understand what's going on I'd need to have a full repro, with the migration snapshot before the migration was added, the full set of instructions, etc. I'm not sure it's worth going into this at this point, unless we see lots of other people running into it...
from efcore.pg.
Thanks @roji for the support, much appreciated.
I now see why this is confusing, it was hard to reproduce, so I made a clone of the actual project and stripped it down to the slimmest structure, so it contains only the bits that are related to the database. Here is the repo I created (README contains the repro steps):
https://github.com/mshwf/npgsql-rename-xmin-issue
Hope it helps!
from efcore.pg.
I think I found why this behavior happens with me...
In the OnModelCreating
I convert column names to lowercase:
var entityTypes = modelBuilder.Model.GetEntityTypes();
var entityProperties = entityTypes.SelectMany(e => e.GetProperties()).ToList();
foreach (var prop in entityProperties)
{
var colName = prop.GetColumnName(StoreObjectIdentifier.Table(GetTableName(prop)!, GetSchemaName(prop)!));
prop.SetColumnName(colName?.ToLower());
}
This includes the new version column as well, so, all I needed is to skip this column:
var entityTypes = modelBuilder.Model.GetEntityTypes();
var entityProperties = entityTypes.SelectMany(e => e.GetProperties()).ToList();
foreach (var prop in entityProperties)
{
// Concurrency tokens are system columns that we shouldn't try to alter their letter-casing
if (prop.IsConcurrencyToken) continue;
var colName = prop.GetColumnName(StoreObjectIdentifier.Table(GetTableName(prop)!, GetSchemaName(prop)!));
prop.SetColumnName(colName?.ToLower());
}
from efcore.pg.
Related Issues (20)
- migration on changed includedPropertyNames for IsGeneratedTsVectorColumn creates up/down code in wrong order
- "integer out of range" error when using date_part in where clause with another conditional HOT 1
- Writing values of 'NpgsqlTypes.NpgsqlRange`1[[System.TimeSpan, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]][]' is not supported for parameters having NpgsqlDbType '-2147483608'. HOT 3
- Error : ''failure to parse near offset 7489. expected an ascii digit,, when runing from EF core .Net 8 HOT 2
- Error : ''failure to parse near offset 7489. expected an ascii digit,, when runing from EF core .Net 8 HOT 5
- Feature Request: protect connection string literal in memory HOT 2
- Support value conversion with generated properties HOT 4
- Running simultaneous queries on different DbContext instances leads to `NpgsqlOperationInProgressException` HOT 3
- Map User Defined Function return table value with parameter timestamp without time zone HOT 3
- Reverse engineering for view does not preserve nullability of columns HOT 4
- ISSUE: A PostgreSQL type with the oid '0' was not found in the current database info
- SQL translation error when using LEFT JOIN in `Where` HOT 6
- Upgrading INpgsqlArrayConverter to PrimitiveCollection
- EF.Functions support for json_array_length HOT 2
- Npgsql.PostgresException (0x80004005): 42883: function st_contains(deployment.geometry, deployment.geometry) does not exist HOT 4
- ISet<EnumType>.Contains() does not translate in EF Core 8 HOT 1
- EF.Functions.JsonContains() occurs issue after upgrade to .net 8
- Querying a DateTimeOffset in a jsonb as JsonDocument fails with InvalidCastException
- Translation from Contains to strpos leads to extremely slow queries HOT 1
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.