Postgresql has a limit of 63 characters - relationships

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
Posts: 1
Joined: Thu 29 May 2014 14:05

Postgresql has a limit of 63 characters - relationships

Post by ripley » Thu 29 May 2014 14:11

I am using dotConnect for Postgresql and I am having a problem with the way entity framework code first generates table relationship names. The convention seems to be < ChildTableName>_<ParentTableName>_<Column>. Since my table and column names are long this results in long relationship names. Postgresql has a limit of 63 characters for identifiers so this causes a problem for me. Is there a way to modify this convention? If not, what other options (apart from using shorter table and column names) do I have?

Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Postgresql has a limit of 63 characters - relationships

Post by MariiaI » Fri 30 May 2014 08:02

There is a config.CodeFirstOptions.TruncateLongDefaultNames configuration option, which is used to provide the possibility of truncating long default names of indexes, primary keys, foreign keys, triggers, and sequences generated by Code-First Migrations.
Please refer to ... tions.html.

For example, you can do it in the code:

Code: Select all

var config = Devart.Data.PostgreSql.Entity.Configuration.PgSqlEntityProviderConfig.Instance;
config.CodeFirstOptions.TruncateLongDefaultNames = true;
Also, you can do it in the config file. For example:

Code: Select all

     <section name="Devart.Data.PostgreSql.Entity" type="Devart.Data.PostgreSql.Entity.Configuration.PgSqlEntityProviderConfigurationSection, 
Devart.Data.PostgreSql.Entity, Version=, Culture=neutral, PublicKeyToken=09af7300eec23701" />
  <Devart.Data.PostgreSql.Entity xmlns="">
    <CodeFirstOptions TruncateLongDefaultNames="true" />
Please tell us if this helps.

Post Reply