在红移时在列几何图形中插入数据



我在redshift中的一个数据库上创建了这个表;并尝试插入数据。您知道如何将点坐标插入柱几何图形中吗?

CREATE TABLE airports_data (
airport_code character(3),
airport_name character varying,
city character varying,
coordinates geometry,
timezone timestamp with time zone
);

INSERT INTO airports_data(airport_code,airport_name,city,coordinates,timezone) 
VALUES ('YKS','Yakutsk Airport','129.77099609375, 62.093299865722656', 'AsiaYakutsk');

我在尝试插入时出错。

查询延迟时间:13 m 05 s错误:指南针I/O异常:无效找到个十六进制字符

在Redshift中,将经度和纬度值设置为几何对象。用途:

ST_Point(longitude, latitude) -- for an XY point

ST_GeomFromText('LINESTRING(4 5,6 7)') -- for other geometries

您的INSERT VALUES中缺少城市,并且"AsiaYakutsk"不是有效的日期时间值-请参阅https://docs.aws.amazon.com/redshift/latest/dg/r_Datetime_types.html#r_Datetime_types-时间戳

忽略您的时区列并将城市添加到值中,请使用以下方法:

INSERT INTO airports_data(airport_code,airport_name,city,coordinates)
VALUES ('YKS','Yakutsk Airport','Yakutsk',ST_Point(129.77099609375, 62.093299865722656));

最新更新