I'm new to PostgreSQL so sorry if I haven't explained myself clearly!
I've used the below query to find out the max character length of each column in my table. I now want to be able to shorten each column to the largest character length. Can anyone help?
SELECT MAX(char_length(gid)) as column1, MAX(char_length(column2)) as column2 FROM schema.table
The reason I want to do this I want to export to shapefiles and the file size is huge as the majority of the columns are set to 254.