Avatar of Peter Chan
Peter Chan
Flag for Hong Kong asked on

Issue to run query

Hi,
What is wrong below? Is it the place to run query?
8a.png
PostgreSQLDatabases* Postgresdatabase

Avatar of undefined
Last Comment
Bill Prew

8/22/2022 - Mon
slightwv (䄆 Netminder)

Nothing is wrong with the syntax.  If you are using copy/paste, make sure there aren't any special characters in the text.

Bill Prew

I suspect the problem is because you have broken the single SQL query across multiple input lines.  

Try typing it all on a single line to see if that works, like below.  If that works then you will have to look for information on how the psql command line wants you to input multiple lines, I don't recall off hand.

SELECT * FROM pg_catalog.pg_tables WHERE schemaname != 'pg_catalog' AND schemaname != 'information schema';

Open in new window


»bp
Bill Prew

Sorry, I'd still try the test above, but I see that the prompt did change in your screenshot, so it appears it handled the multi-line input okay.

Did you type those lines in, or paste them?  As mentioned above, if pasted it could be a non-visible character (like a TAB) that is causing a problem perhaps?


»bp
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
Peter Chan

ASKER
Thanks a lot.
I run it in one line below but there is issue happened.
9d.png
slightwv (䄆 Netminder)

Are you pasting it in or manually typing it in?


I still say invalid character.  If you are using a UTF editor, it might not be a space character you are pasting.

Peter Chan

ASKER
Thanks.
I further get problem below. Please help.
10a.png
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
slightwv (䄆 Netminder)

You aren't answering our questions.


Are you physically typing into the psql window or pasting the command into it?

Bill Prew

So you are no longer getting the error on the "*" in the query, what did you do differently to get past that???


»bp
Peter Chan

ASKER
I am pasting query into that.

Yes, original issue has been resolved.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
slightwv (䄆 Netminder)

>> I am pasting query into that.


Then you need to make sure you are pasting what you think you are pasting.  Something you are pasting isn't correct.

SOLUTION
Bill Prew

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Peter Chan

ASKER
It is strange. Nothing is special below:

SELECT * FROM pg_catalog.pg_tables WHERE schemaname <> 'pg_catalog' AND schemaname <> 'information_schema';

Open in new window

ASKER CERTIFIED SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Bill Prew

You could also save the query to a file, and then just reference the file in the postgres command where you are pasting.  Try saving to a file and then referencing the file like:


\i query.sql

Open in new window


Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.