Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


when I post a query into PgAdmin I get an error, but when I type it I do not.  Why?

Posted on 2011-03-25
Medium Priority
Last Modified: 2012-05-11
I have a query

ALTER TABLE tbl_trades_all RENAME COLUMN "StlDate" TO stldate;

that I paste into the query editor.  When I paste it, I get the following error:

ERROR:  syntax error at or near "ALTER TABLE tbl_trades_all RENAME COLUMN "
LINE 1: ALTER TABLE tbl_trades_all RENAME COLUMN "StlDate" TO stldat...

********** Error **********

ERROR: syntax error at or near "ALTER TABLE tbl_trades_all RENAME COLUMN "
SQL state: 42601
Character: 1

However, if I type the query, it works.  Does anyone know why?
Question by:billelev
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
LVL 40

Accepted Solution

lcohan earned 2000 total points
ID: 35218314
Your clipboarb may be unicode and when you past in PG query which is UTF8 it will have diferent encoding - try copy your text to a 100% ANSI text file then copy from that text file past in PG and run it - should be fine.
I get this issue often when I copy from outlook mails sent by my buddies and paste in PG.

Author Comment

ID: 35218847
I'm using Excel/Notepad++

What would a 100% ANSI text file be?  I just tried copying from Windows Notepad and that did not work.
LVL 40

Expert Comment

ID: 35218991
Try ope a New Test file, past your string in there, Save As and change the type/encoding to ANSI.
Reopen that file, copy the string from it and paste in PGADMIN must work.

Author Comment

ID: 35219382
The method I found that worked was to paste the text into my google search bar first...Nice!
LVL 40

Expert Comment

ID: 35234341
Similar thing and as I mentioned the failure in PGADMIN is due to the UNICODE caracters in your clipbord and the fix/workaround is to convert them to text by saving them to a text file or as you found in google serach bar or like in a Outlook Subject line on a new email. All these will do same thing - convert your unicode into ansi or utf8 to match PGADMIN encoding.

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many developers have database experience, but are new to PostgreSQL. It has some truly inspiring capabilities. I have several years' experience with Microsoft's SQL Server. When I began working with MySQL, I wanted a quick-reference to MySQL (htt…
By, Vadim Tkachenko. In this article we’ll look at ClickHouse on its one year anniversary.
Steps to create a PostgreSQL RDS instance in the Amazon cloud. We will cover some of the default settings and show how to connect to the instance once it is up and running.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question