Extension development: too short table and columns names

Discuss general development subjects that are not specific to a particular version like the versioning control system we use or other infrastructure.
Post Reply
User avatar
martti
Registered User
Posts: 27
Joined: Wed Aug 20, 2014 4:50 pm
Location: Belgium

Extension development: too short table and columns names

Post by martti » Mon Apr 23, 2018 8:48 am

Table and column names in the database can currently only be 30 characters long.
In order to keep things nicely separated I would always prefix tables and columns from extensions with vendor_extensionname_. But 30 characters is way too short for doing this. Is there any reason why there is a 30 character limit?

User avatar
paulus
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 364
Joined: Thu Sep 16, 2004 9:02 am
Contact:

Re: Extension development: too short table and columns names

Post by paulus » Mon Apr 23, 2018 9:05 am

Yes, some database systems limit the length of a table name.

User avatar
martti
Registered User
Posts: 27
Joined: Wed Aug 20, 2014 4:50 pm
Location: Belgium

Re: Extension development: too short table and columns names

Post by martti » Mon Apr 23, 2018 9:31 am

I did a quick Google search on the databases supported by phpBB. Oracle seems to be the culprit.
  • Oracle:
    • up to version 12.1: maximum 30 bytes
    • From version 12.2 (March 2017): maximum 128 bytes
  • MySQL: 64 characters
  • MariaDB: 64 characters
  • PostGreSQL: default 63 bytes, but configurable to be larger
  • Sqlite3: no hard limit, only limited by the max length of the SQL statement (which is defaulted to 1000000 bytes, but configurable to be larger)
  • MSSQL: 128 characters
How about keeping the 30 character limit for the core, but allowing 63 bytes for the extensions?

User avatar
david63
Registered User
Posts: 244
Joined: Mon Feb 07, 2005 7:23 am
Location: Lancashire, UK

Re: Extension development: too short table and columns names

Post by david63 » Mon Apr 23, 2018 9:59 am

martti wrote:
Mon Apr 23, 2018 9:31 am
How about keeping the 30 character limit for the core, but allowing 63 bytes for the extensions?
That would imply that anyone using Oracle would not be installing extensions (may possibly be true, but cannot be guaranteed)
David
Remember: You only know what you know -
and you do not know what you do not know!

User avatar
martti
Registered User
Posts: 27
Joined: Wed Aug 20, 2014 4:50 pm
Location: Belgium

Re: Extension development: too short table and columns names

Post by martti » Mon Apr 23, 2018 11:10 am

david63 wrote:
Mon Apr 23, 2018 9:59 am
martti wrote:
Mon Apr 23, 2018 9:31 am
How about keeping the 30 character limit for the core, but allowing 63 bytes for the extensions?
That would imply that anyone using Oracle would not be installing extensions (may possibly be true, but cannot be guaranteed)
  • Only Oracle pre 12.2
  • Only extensions that define column or table names longer than 30 chars. It can be a requirement of the extension on the database used.

User avatar
3Di
Registered User
Posts: 732
Joined: Tue Nov 01, 2005 9:50 pm
Location: Milano (I) Frankfurt (D)
Contact:

Re: Extension development: too short table and columns names

Post by 3Di » Tue Apr 24, 2018 5:20 am

Using shorthands/acronyms is the way to go. As it is now, no need to add rules/regulations here IMHO.

mae_settings --->MyAwesomeExtension_settings

If I may say mine I'd like to see people involved in much more important things such as closing long standing tickets etc. etc.
The more the better. :)
Want to compensate me for my interest? Don't ask me, just do it
I'm available for custom phpBB jobs, you can PM me the details.
New: my Live Board, Extensions and Tools for phpBB - Men at works.

User avatar
DavidIQ Online
Customisations Team Leader
Customisations Team Leader
Posts: 1777
Joined: Thu Mar 02, 2006 4:29 pm
Location: Earth
Contact:

Re: Extension development: too short table and columns names

Post by DavidIQ » Tue Apr 24, 2018 12:15 pm

It's also not just table names. There's limitations on index names as well. In any case I'm not sure that adding conditionals to the dbal for doing different things depending on dbms versions is something we'd want to do (more of). However there's been some discussions about just going with Doctrine's ORM instead of continuing with our dbal so maybe this would get addressed at that point.
Image

User avatar
martti
Registered User
Posts: 27
Joined: Wed Aug 20, 2014 4:50 pm
Location: Belgium

Re: Extension development: too short table and columns names

Post by martti » Thu Apr 26, 2018 8:14 am

3Di wrote:
Tue Apr 24, 2018 5:20 am
Using shorthands/acronyms is the way to go. As it is now, no need to add rules/regulations here IMHO.

mae_settings --->MyAwesomeExtension_settings
That's good for now, but it would be cleaner if you use the same prefix everywhere (instant recognisable) for anything related to your extension.
DavidIQ wrote:
Tue Apr 24, 2018 12:15 pm
It's also not just table names. There's limitations on index names as well. In any case I'm not sure that adding conditionals to the dbal for doing different things depending on dbms versions is something we'd want to do (more of). However there's been some discussions about just going with Doctrine's ORM instead of continuing with our dbal so maybe this would get addressed at that point.
Doctrine ORM trims column-names and adds a counter-number, but there is an open bug on it. And I don't know about the indexes and tables.

However, phpBB could implement its own NamingStrategy in Doctrine.

User avatar
martti
Registered User
Posts: 27
Joined: Wed Aug 20, 2014 4:50 pm
Location: Belgium

Re: Extension development: too short table and columns names

Post by martti » Thu Apr 26, 2018 8:50 am

DavidIQ wrote:
Tue Apr 24, 2018 12:15 pm
However there's been some discussions about just going with Doctrine's ORM instead of continuing with our dbal so maybe this would get addressed at that point.
Isn't it Doctrine DBAL instead of ORM? I hope it's not ORM!
https://area51.phpbb.com/phpBB/viewtopi ... rm#p255735

User avatar
DavidIQ Online
Customisations Team Leader
Customisations Team Leader
Posts: 1777
Joined: Thu Mar 02, 2006 4:29 pm
Location: Earth
Contact:

Re: Extension development: too short table and columns names

Post by DavidIQ » Thu Apr 26, 2018 8:59 am

Yeah that. :razz:
Image

Post Reply