Kevin Kopf
Kevin Kopf

Reputation: 14230

Created MySQL view has low column length

I created a view that has a column with value length of over 1500 characters. But when the view is created, the column length is 343 characters.

CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost`
SQL SECURITY INVOKER
VIEW `table_view` AS
    select
        concat("[",
            group_concat(
                concat(
                    '{"column1":"',`column1`,
                    '","column2":"',`column2`,
                    '","column3":"',`column3`,
                    '","column4":"',`column4`,
                    '","column5":"',`column5`,'"}'
                )
            ),
            "]"
        ) as `Big_column`
    from `Table`;

Is it somehow possible to increase it in the created view?

Upvotes: 0

Views: 124

Answers (1)

O. Jones
O. Jones

Reputation: 108806

The GROUP_CONCAT() function has a maximum result length controlled by a system variable called group_concat_max_len. You can read about that here.

You can adjust its length with

SET group_concat_max_len = 2048

or a similar command. Try putting in a larger value for that variable.

But your view tries to pack all the rows of your table into just one column. That seems strange.

Upvotes: 1

Related Questions