12

I am new in PostgreSql. I import the database on my linux machine. I am able to see the list of tables using \d command (GSM_test_db-# \d default_msg_details) its displaying the table list but I want to see the table data.

Any Command that shows table Data also Please tell me.

I already used select query GSM_test_db-# SELECT * FROM default_msg_details but its not displaying anything and its not giving any error.

Please tell me if any command or why this select its not displaying anything.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Amit Singh Tomar
  • 8,380
  • 27
  • 120
  • 199

3 Answers3

23

Because you need to terminate your statement with a ;

Klaus Byskov Pedersen
  • 117,245
  • 29
  • 183
  • 222
  • On adding ";", it gives following error message: ERROR: syntax error at or near ";" LINE 1: SELECT * FROM default_table; – tryingToLearn Oct 17 '14 at 06:33
  • I found the answer here. In addition to adding a semicolon, we need to turn off pagination : http://stackoverflow.com/questions/11180179/postgresql-disable-more-output – tryingToLearn Oct 17 '14 at 06:46
12

Try SELECT * FROM "default_msg_details";

Beside adding ";" at the end of your query, you also need add the quotes("") to your tabel's name as well.

Lisa
  • 2,809
  • 3
  • 24
  • 37
1

Firstly, you need to disable pagination but retain the output:

\pset pager off

Then, use the below query:

SELECT * FROM "default_msg_details";
Sajjad Manal
  • 371
  • 4
  • 25