0

Пытаюсь вставить в базу точку

INSERT INTO "my_points" ("coord_point") VALUES (ST_Point(27.53899097442627,53.902770584646525));

Но почему-то появляется ошибка

SQLSTATE[42804]: Datatype mismatch: 7 ERROR: column "coord_point" is of type point but expression is of type geometry

Поле в таблице имеет тип POINT и вроде как ST_Point должен возвращать такой же тип, а не geometry. Почему такое происходит?

PostgreSQL 9.4, PostGIS 2.1

1

2 ответа 2

0

Решил проблему таким вот способом:

INSERT INTO "my_points" ("coord_point") VALUES (POINT(27.53899097442627 53.902770584646525));
0

Name

ST_Point — Returns an ST_Point with the given coordinate values. OGC alias for ST_MakePoint.

Synopsis

geometry ST_Point(float x_lon, float y_lat);

Description

Returns an ST_Point with the given coordinate values. MM compliant alias for ST_MakePoint that takes just an x and y.

Взято отсюда

Как видно ST_Point возвращает именно геометрию, вообще многое что начинается с ST_ или возвращает или получает geography/geometry.

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.