Format output of postgres from psql

postgres not null

Format output of postgres from psql

Format output of postgres – this is like \G in mysql

If you are looking for the \G equilvalent of the mysql in postgres, then here is what you are looking for:

On the psql terminal just do the following


\x auto;

This will prepare whatever you are going to display on the terminal to have the right output

here is an example of out formatted or nice output when you issue the command


infohub=# select * from help;
-[ RECORD 1 ]+--------------------------------------------------------------------------------------------------------------------------------------
id           | 1
date_created | 2018-08-18 09:58:54.774
message      | use \x auto command to get output printed nicely
title        | how to show the select output nicely formatted in psql
member_id    | 1
-[ RECORD 2 ]+--------------------------------------------------------------------------------------------------------------------------------------
id           | 2
date_created | 2018-08-18 10:41:46.979
message      | postgres has a nice output format option as well.
title        | An equivalent of \G nice format in mysql in postgres
member_id    | 1

As it can be seen above, the output is nice and easy to navigate than a bulky columns here and there.

See how you would solve these known algorithm problems

testing k complementary pairs algorithm with junit

Java solution for checking anagram strings – tell if phrases are anagrams

Check if two strings are anagrams or not

Find longest palindrom from sequence of characters

String Ordered Permutation Algorithm Problem

Implementing tokenizer and adding tokens to the linked list

Check if there are three numbers a, b, c giving a total T from array A

Find K Complementary numbers from array Java implementation

binary tree problems with solution

Kadane’s algorithm in C – Dynamic Programming

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*