25

In pgAdmin4 (version 5.5), when a SELECT * FROM tablename; query is executed, one can see on the bottom panel, under a tab called "Data Output", the resulting records for the selected columns for the specified table.

screenshot of the problem

If this table is having columns with very long string of data, e.g when encoded as JSON objects, or any PostGIS complex geometries, their width can be extraordinarily large, which affects the user experience negatively. Because going to some of the columns becomes a sub-pixel game when one try to grab and move the tiny horizontal slider (e.g. moving the slider half a pixel can move several columns by more than 2x the width of the screen...).

Did I miss something in the settings?
Is there a way to fix that, e.g. by setting a maximum width value for the columns? Because when using pgAdmin out-of-the-box, they are fully expanded...

I remember that is was not the case in earlier versions (4.x).

I'm using the latest dockerized version (5.5) as documented on the pgAdmin4 doc and available here: https://hub.docker.com/r/dpage/pgadmin4/

OS: Ubuntu 18.04
Web Browser: Firefox 89.0.2 (64-bit)

swiss_knight
  • 5,787
  • 8
  • 50
  • 92

3 Answers3

43

You can set the maximum width value for columns under File -> Preferences -> Query tool -> Results grid

Max column width setting pgAdmin 4

max column width setting pgAdmin 4

bad_coder
  • 11,289
  • 20
  • 44
  • 72
theDude
  • 546
  • 6
  • 5
  • 1
    Thanks a lot! I actually never went into those menus up there! Shame on me! ;) By default the value is `0`, which probably means "use the maximum width of the selected value" for each column. This is working on version pgAdmin4 version `5.7`. – swiss_knight Sep 28 '21 at 17:38
  • You saved my life. I've been annoyed about this for so long. – Akaisteph7 Apr 15 '22 at 16:57
  • Instead of specifying Max col width we can change Columns sized by from `Column data` to `Column Name`. This will simply take width of column name instead of data. Hence, you'll always see the column name and data can be seen by double-clicking on data. – HeroicHitesh Aug 02 '22 at 12:04
  • I just had to restart pgAdmin after making this change. – zeeshan Jun 01 '23 at 15:14
3

In the newest version of PG Admin v6 (6.7 as of 3/18/22) they changed this yet again. It is in the same place, but the option no longer lets you set the width. There is just a radio option to have super wide columns or base the width off of the column name

Preferences Screen PG admin 6.7

0

I am using PostgreSQL 11.17

  1. Go to File menu > click on Preferences
  2. From Preferences window scroll down to Query tool
  3. From the list under Query Tool > click on result grid
  4. Select Column name in the Columns sized by field
  5. Click save
  6. Reopen the table you were having issue with due to column width
S_Jin
  • 31
  • 2