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
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
  • 3
  • 2
LVL 40

Accepted Solution

lcohan earned 500 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Best database to use for Maps is PostgreSQL. This is an open source database. Comes as a package with most Linux OS. For more info visit the following site: ( This requires some add-o…
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…
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.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

679 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