我使用redshift spectrum查询S3数据,但是出现保留字冲突问题

I used redshift spectrum to query S3 data, but I am having a reserved word conflict problem

我正在尝试使用红移光谱查询 S3 数据。

table 有一个 oid 列,table 是使用粘合爬虫创建的。

我尝试在 redshift 中使用此命令获取数据。

select * from db.table order by pid desc limit 1

但是出现错误。

[XX000] ERROR: Failed to incorporate external table "db"."table" into local catalog. Error=column name "oid" conflicts with a system column name

很难更改文件。有没有办法在不更改文件的情况下解决这个问题?

有意思。如果这是一个正常的 table,则您必须将用作列名的保留字加双引号。这如何扩展到外部 table 可能很有趣。有

select "pid", "oid" from db.table order by pid desc limit 1;

工作?

我认为 Redshift 可以将 * 扩展到列名中,然后再将它们传递给频谱引擎。 (或者它可能是其他东西。)如果这可行,它建议扩展列并引用保留字列名称作为解决方法。