Okay
  Public Ticket #2409522
limit number of columns
Closed

Comments

  • FABIO started the conversation
    Hi I'm trying to create a table with about 40 columns but at number 27 it doesn't make me add anything anymore.
    Is there any limitation?
  •  471
    Isidora replied

    Hi FABIO,

    Thank you for your purchase.

    Yes there is a limit on MySQL side that have limit where you can have a maximum row size of 65,535 bytes and size for sting columns is set to VARCHAR( 255), selectboxes are set to default on VARCHAR( 2000)... All default settings for column type size you can find in function defineColumnProperties which you can find in file 

    wp-content/plugins/wpdatatables/source/class.constructor.php around line 107. 

    There you can reduce this sizes  for each column type and then try to make a table. Please note that it will not be affected on already created table because this is already created in database. You will need to manually change it in database for already created tables.


    Kind Regards, 

    Isidora Markovic

    wpDataTables: FAQFacebookTwitterFront-end and back-end demoDocs

    Amelia: FAQFacebookTwitter |  Amelia demo sites | Docs

    You can try our wpDataTables add-ons before purchase on these sandbox sites:

    Powerful FiltersGravity Forms Integration for wpDataTablesFormidable Forms Integration for wpDataTables

  • FABIO replied


    Good morning I don't understand this answer because it doesn't say if I have a limit on the number of columns. My table has 27 columns and it doesn't make me create column 28. This is what mysql indicates and I would say that it doesn't affect my problem https://dev.mysql.com/doc/refman/8.0/en/column-count -limit.html
    I would be grateful to you for giving me a less approximate answer.

    Thanks

  •  2,507
    Aleksandar replied

    Hello Fabio

    The columns you create with wpDataTables are stored in the database.

    Each column has a type and length.

    If you have simple string columns, each column is saved as VARCHAR with the character limit of 255 in the database.

    If you created some selectbox or multiselectbox columns, they are saved as VARCHAR, but with the character limit of 2000 in the database.

    In combination with other column types, you probably reached the limit in your database, and this is why you can't add more columns. The plugin itself doesn't have a column limit, but the database does. MySQL has hard limit of 4096 columns per table, and the exact column limit depends on several factors.

    You can read more about that here, but to fix the issue, you should follow Milan's advice and simply lower the character limit in our code. After that you will need to either create a new table, which will not have these limitations, or edit the existing table in the database, by lowering the character limit in column structure settings.

    Kind Regards, 

    Aleksandar Vuković
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables