2

I'm using PostgreSQL server on my Windows. I have created table user(id, name, age) and inserted some data there.
When I'm trying to retrieve that data via SELECT ALL FROM user I'm getting only the rows count and just plain nothingness.

How it looks like in psql CLI:
cmd

...and I'm also receiving empty object array as query result in my nodejs app:
enter image description here

2 Answers 2

2

Postgres supports SELECT ALL as a synonym for SELECT -- as a two words syntax parallel to SELECT DISTINCT. The ALL does nothing.

In addition, Postgres -- unlike other databases -- allows a SELECT to select no columns.

So:

SELECT ALL
FROM user;

Selects all the rows from user but no columns. In general, you would instead write:

SELECT *
FROM user;

to see the contents of the rows. If you want to be verbose, yo could use:

SELECT ALL *
FROM user;

But that is used somewhere close to never in practice.

Sign up to request clarification or add additional context in comments.

Comments

0

You specified that you want the data from the column named "all". To get data from all columns you need to specify them all or use the asterisk symbol like so:

SELECT * FROM "user";

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.