• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 590
  • Last Modified:

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

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
billelev
Asked:
billelev
  • 3
  • 2
1 Solution
 
lcohanDatabase AnalystCommented:
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
 
billelevAuthor Commented:
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
 
lcohanDatabase AnalystCommented:
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
 
billelevAuthor Commented:
The method I found that worked was to paste the text into my google search bar first...Nice!
0
 
lcohanDatabase AnalystCommented:
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

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now