FirebirdSQL / firebird

Firebird server, client and tools
https://www.firebirdsql.org/
1.26k stars 216 forks source link

Report name and fact/max length of name of database objects when length exceeding [CORE5903] #6161

Open firebird-automations opened 6 years ago

firebird-automations commented 6 years ago

Submitted by: Maxim Kuzmin (cybermax)

Votes: 2

When creating various object of database and length thier names exceeding maximal, get error.

Example for package: CREATE OR ALTER PACKAGE VERY_VERY_LONGEST_NAME_OF_PACKAGE AS BEGIN

END

Invalid token. Dynamic SQL Error. SQL error code = -104. Name longer than database column size.

Example for table: CREATE TABLE VERY_VERY_LONGEST_NAME_OF_TABLE1 ( NEW_FIELD INTEGER)

Invalid token. Dynamic SQL Error. SQL error code = -104. Name longer than database column size.

Example for exception: CREATE EXCEPTION VERY_VERY_LONGEST_NAME_OF_EXCEPTION

Invalid token. Dynamic SQL Error. SQL error code = -104. Name longer than database column size.

From the message, neither the object type, nor its name, nor its actual length is understood. Sometimes, in executing script or other work, it's causes inconvenience. Propose extending error message like this:

Invalid token. Dynamic SQL Error. SQL error code = -104. Name longer than database column size. Length name of package "VERY_VERY_LONGEST_NAME_OF_PACKAGE" exceed maximum 31 chars on 2 (fact 33);

Invalid token. Dynamic SQL Error. SQL error code = -104. Name longer than database column size. Length name of table "VERY_VERY_LONGEST_NAME_OF_TABLE1" exceed maximum 31 chars on 1 (fact 32);

firebird-automations commented 6 years ago

Commented by: Sean Leyne (seanleyne)

I don't think it is necessary to report the number of characters that the length exceeds by, the message details should make that obvious.

As for the text of the error message, something more like this would read better: Length name of {Object Type} "{Object Name}" ({Length value}) exceeds maximum of {Max Length},

Eg: Length name of Table "VERY_VERY_LONGEST_NAME_OF_TABLE1" (32) exceeds maximum of 31

firebird-automations commented 6 years ago

Commented by: @livius2

Maybe better Eg: Name of Table "VERY_VERY_LONGEST_NAME_OF_TABLE1" (32) exceeds maximum Length of 31

firebird-automations commented 6 years ago

Commented by: @dyemanov

I'd leave the character counting up to users: Metadata (or <object>) name "VERY_VERY_LONGEST_NAME_OF_TABLE1" exceeds maximum supported length (31 characters)

firebird-automations commented 6 years ago

Commented by: Sean Leyne (seanleyne)

@Dmitry,

If we have the length, what is the harm in providing the value? (It let's the user know by how much the name needs to be trimmed)

_Accurately_, counting 31 characters is one thing, counting 60+ is another.

firebird-automations commented 6 years ago

Commented by: Maxim Kuzmin (cybermax)

@Dmitry Yemanov,

As @Sean Leyne already said, knowledge of the actual length or the number of characters of the excess, simplifies the name adjustment.