cds-dbm icon indicating copy to clipboard operation
cds-dbm copied to clipboard

Table names max length

Open sedacrivity opened this issue 2 years ago • 2 comments

Hi,

It seems that the max length of a table name in Postgresql is 63 bytes.

I am getting errors now during the initial deploy as it is trying to create views that already exist - because the names get truncated at 63 chars and are therefore similar.

I am not using a fancy long name but the names are that long due to the pattern 'service name_view' ( which seems logical ).

eg

ApiPublicProfilesManagersDataManagementService_DataCampaignsSteps ApiPublicProfilesManagersDataManagementService_DataCampaignsStepsStats

both end up being

apipublicprofilesmanagersdatamanagementservice_datacampaignsste

Hence the error:

ERROR: relation "apipublicprofilesmanagersdatamanagementservice_datacampaignsste" already exists STATEMENT: CREATE VIEW ApiPublicProfilesManagersDataManagementService_DataCampaignsStepsStats AS SELECT

So it is not really an issue persé but something to be aware off ...

Thanks,

Steven

sedacrivity avatar Apr 07 '22 12:04 sedacrivity

You are right. Namespaces should be kept short to have enough characters available for the respective tables/views. I am going to add this to the readme.

mikezaschka avatar Apr 07 '22 13:04 mikezaschka

@mikezaschka Great !

In this particular case it is the actual service name which is ( in retrorespect ) hmmm rather unnecessary big ...

service ApiPublicProfilesManagersDataManagementService

But indeed namespace or servicename are taken into account so it can add up quickly.

sedacrivity avatar Apr 07 '22 13:04 sedacrivity