What happens if text value exceeds character limit?

Bubble manual notes that a single text field saved in the database has a hard limit of 10 million characters. What happens if app attempts to save a longer value? Is the value truncated and the first 10M characters are saved? Is no value saved?

Good question! Honestly not sure. Maybe @mikeloc @NigelG or @keith can shed some light?

My guess would be that it truncates the value, but I don’t know, and I’m not about to try to test it. :slight_smile:

1 Like

Good question, I just tested it. It didn’t save or error. The workflow ran in step by step and finished but nothing appeared in database.

I used 10,000,001 characters then tried with 9,999,998 and it did the same thing. So tired with 9,999,900 and got same result.

2 Likes

Thanks, all. Here’s my scenario that prompted the question, in case it prompts further insights or guidance from anyone.

I’m compiling JSON to use in the 1T - CSV Creator plugin’s “Send JSON to a CSV Creator” workflow action. The data involves a variable number of rows and columns as well as character lengths of individual values. I started with my compilation expression in a MultilineInput on a page (which facilitates troubleshooting the syntax) whose value I then referenced in the workflow action. With short outputs, that worked fine. However, longer outputs (e.g., hundreds or thousands of rows) required several minutes to render, which is not tenable in terms of UX–or even sometimes yielded a “temporary bug” error. I then tried moving the compilation expression directly to the action in the page’s workflow, but observed the same issues.

So, I moved the compilation expression to a backend workflow. There, it processes promptly and reliably. In order to then be able to reference the output in a “Send JSON to a CSV Creator” action, which is an element action available only in a page workflow and not in a backend workflow, I used an action to save the the compiled JSON in a text field.

Hence, my question. In the preponderance of cases, the length of the compiled JSON would not approach 10M characters. If it did exceed that limit, ideally the value would be truncated and I’d have the app alert the user. So, it sounds prudent to preemptively truncate the value, save that, and then provide an alert to the user if the field value’s length matches the limit.

So, that was my plan based on Bubble’s documentation of the 10M character hard limit. However, it sounds like others’ probing suggests there’s a lower limit. If there were a way to establish that, I’d impose that maximum rather than 10M. Even more importantly, if the limit is low enough that it constrains more scenarios than my users’ outlier use cases, I need to try to design a different approach altogether–e.g., spilt the compiled JSON across multiple fields.