find coumn name and his type with greatest size in bytes

From: Алексей Ефимов <asefimov(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: find coumn name and his type with greatest size in bytes
Date: 2023-03-09 14:45:29
Message-ID: CAHCu-H8z3W1G+2qmr9BgWUb0QO02bBT+9DhG_ZBR2i9nH5Wexg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello all!
can you help, i need to write a query that displays column name with his
data type that have maximum bytes length in row for every table in database:

for example, for table employees with data:
emp_id, emp_name, emp_dept, emp_surname
1 alexey 2 trew

i need to get such output:

table_name, emp_id, column_name, bytes, datatype
employees 1 emp_name 6 text

Browse pgsql-general by date

  From Date Subject
Next Message Dominique Devienne 2023-03-09 15:18:57 Re: public schema grants to PUBLIC role
Previous Message David G. Johnston 2023-03-09 13:22:02 Re: crosstab