Warm tip: This article is reproduced from serverfault.com, please click

PostgreSQL: ST_GeomFromText(unknown) does not exist

发布于 2015-02-25 11:05:50

Here is the problem,

I just installed PostgreSQL right now and try to build a geoloc database. For this, i installed the PostGIS extension and PostGIS_Topology.

In my pgAdmin UI, i can see my model, my schema is "Geo" and I can see below, in the functions list, the postGis functions that are available (about 1000, see screenshot)

Problem is, when I try to insert a new record in the database, Example:

INSERT INTO "Geo".points(point, lat, lng) VALUES (ST_GeomFromText('POINT(42.555 32.222)'),'42.555','32.222');

I get this error :

ERROR : function st_geomfromtext(unknown) does not exist
SQL state : 42883
Character : 51

Thought problem was coming from extension maybe not enabled, but seems like it is ok, list of functions is visible in the db model informations...

also tried to call the function from the db name, but not working...

..."Geo".ST_GeomFromText('...')...

Another strange thing is that, when I try this command :

SELECT "Geo".ST_GeomFromText('POINT(42.222 32.555)')

It works...

Here is a screenshot :

enter image description here

I'm NEW in PostgreSQL so maybe this is a stupid issue... But I looked through stack and the doc and don't find anything that match my problem...

Thanks for reading/help

[EDIT]

After testing your solution @mlinth I still face the same problem...

When trying

INSERT INTO "Geo".points(point, lat, lng) 
SELECT "Geo".ST_GeomFromText('POINT(32.222 42.555)'),'42.555','32.222';
or
INSERT INTO "Geo".points(point, lat, lng) 
SELECT "Geo".ST_point(32.222,42.555 ),'42.555','32.222';

I face Error , SQL state : 42804 character 51 ("Geo" is underlined) Removing "Geo" results in a error like "Function ST_GeomFromText (or ST_POINT) (unknown) does not exist"...

[EDIT2]

this function seems to work :

SELECT "Geo".ST_GeomFromText('POINT(42.222 35.555)')

it returns

    st_geomfromtext "Geo".geometry
1 : "010100000023DBF97E6A1C4540D7A3703D0AC74140"

Create statement :

CREATE TABLE "Geo".points
(
  id serial NOT NULL,
  point point NOT NULL,
  lat text,
  lng text,
  CONSTRAINT points_pkey PRIMARY KEY (id)
)
WITH (
  OIDS=FALSE
);
ALTER TABLE "Geo".points
  OWNER TO postgres;
Questioner
Julo0sS
Viewed
0
mlinth 2015-02-25 20:42:31

Point is not a PostGIS type, it's a native Postgresql type.

I think you need to make your point column type geometry, then the PostGIS functions will work.