Solved

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
5
571 Views
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?
0
Comment
Question by:billelev
  • 3
  • 2
5 Comments
 
LVL 39

Accepted Solution

by:
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.
0
 

Author Comment

by:billelev
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.
0
 
LVL 39

Expert Comment

by:lcohan
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.
0
 

Author Comment

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

Expert Comment

by:lcohan
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.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

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: http://www.postgresql.org/ (http://www.postgresql.org/) 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.
This video discusses moving either the default database or any database to a new volume.

746 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now