based on Nikhil Benesch idea.
The attached diff is based on
v1-0002-Rewrite-ArrayCount-to-make-dimensionality-checks.patch.
diff compare v1-0002:
select '{{1,{2}},{2,3}}'::text[];
ERROR: malformed array literal: "{{1,{2}},{2,3}}"
LINE 1: select '{{1,{2}},{2,3}}'::text[];
^
-DETAIL: Unexpected "{" character.
+DETAIL: Multidimensional arrays must have sub-arrays with matching dimensions.
----------------------------------------------------
select E'{{1,2},\\{2,3}}'::text[];
ERROR: malformed array literal: "{{1,2},\{2,3}}"
LINE 1: select E'{{1,2},\\{2,3}}'::text[];
^
-DETAIL: Unexpected "\" character.
+DETAIL: Multidimensional arrays must have sub-arrays with matching dimensions.
-------
new errors details kind of make sense.