1
我有這個(非工作)查詢:插入點到POSTGIS啓用的Postgres數據庫
"INSERT INTO notes (
lat,
lng,
point)
VALUES (
:lat,
:lng,
ST_GeometryFromText('POINT(:lat :lng)'))"
對此我對這個表運行:
(PHPCREATE TABLE notes
(
id serial NOT NULL,
lat real NOT NULL,
lng real NOT NULL,
point point NOT NULL,
CONSTRAINT notes_pkey PRIMARY KEY (id)
)
查詢與PDO準備)但這不是我認爲的觀點。我得到的結果是一個例外,聲稱:
SQLSTATE[42804]: Datatype mismatch: 7 ERROR: column "point" is of type point but expression is of type geometry
LINE 8: $8, $9, $10, $11, $12, ST_GeometryFromText('POINT(:...
^
HINT: You will need to rewrite or cast the expression.
我該如何建立表達式?
哦,所以當我做'CREATE EXTENSION postgis;'新的數據類型被添加? – nourdine
@nourdine:是的。很多新的類型和功能和其他東西。 –