postgresql - aws rds postgres9.6:在数据库恢复地理位置列后返回字符串而不是对象
问题描述
我有一个自动恢复脚本,它已经运行了大约 1 年,但在上个月,有些东西发生了变化,导致地理请求以字符串而不是对象的形式返回。同一集群中较旧的数据库以完全相同的值正确返回,因此在完成还原后我正在努力找出列/数据的问题?
我有一个测试 nodejs 脚本,它使用 sequelize 作为 ORM 来单独测试 dbs。我最初认为这是 ORM 的问题,但考虑到它适用于一个数据库而不是另一个数据库,具有完全相同的数据,这让我认为恢复的数据库有问题。作为字符串而不是对象返回的代码块是:
geoPointLocation: {
type: Sequelize.GEOMETRY('POINT'),
defaultValue: DEFAULT_GEOPOINT,
},
...
const geoPointLocation = this.getDataValue('geoPointLocation');
...
从数据库中“看起来”它们完全一样,但显然我错过了什么?
框架执行的查询:
SELECT "name", "address", "geoPointLocation" FROM "Locations" AS "Locations" WHERE "Locations"."name" = 'this-issue-sucks';
工作数据库 <<
postgres@working_db=> select ST_IsValid("geoPointLocation") from "Locations" where name = 'this-issue-sucks';
-[ RECORD 1 ]-
st_isvalid | t
postgres@working_db=> select st_asText("geoPointLocation") from "Locations" where name = 'this-issue-sucks';
-[ RECORD 1 ]----------------------------
st_astext | POINT(-77.0365739 38.8976633)
postgres@working_db=> select "geoPointLocation" from "Locations" where name = 'this-issue-sucks';
-[ RECORD 1 ]----+-------------------------------------------
geoPointLocation | 0101000000C7180E3A574253C0E3288AA1E6724340
失败的数据库<<
postgres@temp_geo=> select ST_IsValid("geoPointLocation") from "Locations" where name = 'this-issue-sucks';
-[ RECORD 1 ]-
st_isvalid | t
postgres@temp_geo=> select st_asText("geoPointLocation") from "Locations" where name = 'this-issue-sucks';
-[ RECORD 1 ]----------------------------
st_astext | POINT(-77.0365739 38.8976633)
postgres@temp_geo=> select "geoPointLocation" from "Locations" where name = 'this-issue-sucks';
-[ RECORD 1 ]----+---------------------------------------------------
geoPointLocation | 0101000020E6100000C7180E3A574253C0E3288AA1E6724340
解决方案
推荐阅读
- javascript - Vue.js(laravel6)的控制台中未显示值并出现错误
- ionic4 - ionic 4 从 Json 创建动态多步表单
- android - 颤振中的闪屏出现在哪里?
- python - 创建一个遍历数据帧行的函数,应用 scipy 函数,将输出附加到新列并输出修改后的数据帧
- angular - 将变量动态更改为 ngmodel 不起作用
- python - 我试图在 python 上解决以下问题,我得到了正确的输出,但它们仍然显示错误
- google-apps-script - 在 1 个主 onEdit 下运行的 onEdit 脚本太多?GoogleSheets / Google Apps 脚本
- c++ - 有没有办法在使用矢量浮点数时避免来自 clang++(紫红色默认参数)的警告?
- python - 如何复选框以启用 Tkinter 中的按钮
- ios - 使用指针从 Parse 中保留行