2

I am using psql (9.5.2) and postgis 2.2.2. In the psql shell, I have created a spatial database and connected to it. I want to insert a point into the postgis geodatabase.

To do so, I first create a table in the database:

CREATE TABLE table1 ( 
  p_id INTEGER PRIMARY KEY

);

Then I want to create a point using:

select st_point(­101, 20);

However, I got an error:

ERROR:  column "­101" does not exist

What is the reason of this error?

8
  • 1
    Is PostGIS installed, check with select postgis_version(). For some reason, if I copy-paste your SQL I am getting the same error but if I write the text from the keyboard the query is successful.
    – user30184
    Apr 17, 2016 at 17:20
  • Have you tried ST_Point? Commands might be case-sensitive.
    – AndreJ
    Apr 17, 2016 at 17:27
  • That really works. The prompt returned "st_point -------------------------------------------- 010100000000000000004059400000000000003440 (1 row)". But I was expecting the st_point function to return the coordinate values. Do you have the same return result?
    – enaJ
    Apr 17, 2016 at 17:27
  • 1
    It gives error too for me if I copy paste. it's the -- is not really a minus coming thru. I had to replace the -- with a - and then it worked.
    – LR1234567
    Apr 17, 2016 at 17:57
  • 2
    The default return value is a hexadecimal dump of the binary object. You need to use ST_AsText(geomcol) to get Well-Known Text.
    – Vince
    Apr 17, 2016 at 18:35

1 Answer 1

1

You have a hidden soft hyphen character before 101, e.g. copy & paste into a Python shell shows me:

select st_point(\xc2\xad101, 20);

Retype this SQL statement using ASCII characters, and it should work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.