Created
July 30, 2019 15:05
-
-
Save a88zach/580cf94713801bec16b790dd0b3f8298 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select table_schema, | |
table_name, | |
column_name, | |
data_type, | |
character_maximum_length, | |
(xpath('/row/max/text()',query_to_xml(format('select max(length(%I)) from %I.%I', column_name, table_schema, table_name), true, true, '')))[1]::text::int as max_length | |
from information_schema.columns | |
where table_schema = 'ccxp' | |
and data_type = 'character varying' | |
order by table_schema, table_name, column_name; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment