postgresql - 使用 desc 在 postgresql 上创建索引时出错

标签 postgresql indexing

在 postgresql 8.2 上执行以下命令时:

CREATE INDEX product_index_8 ON product (product_id DESC, naam DESC, verbruik_per_eenheid DESC, inhoud DESC, barcode DESC);

我们得到错误:

  ERROR:  syntax error at or near "DESC"
    LINE 1: ...EATE INDEX product_index_8 ON product (product_id DESC, naam...  
    ********** Error **********   
    ERROR: syntax error at or near "DESC"
    SQL state: 42601
    Character: 53

谁知道这是怎么回事?我们在 oracle 服务器上有相同的索引,它可以正常工作。

最佳答案

据推测,您使用的不是 PostgreSQL,而是 Greenplum 数据库或 Amazon Redshift。

如果你真的在使用 8.2:PostgreSQL 8.2 does not support DESCending ordered indexes .

Newer versions do - 它是在 8.3 中添加的,根据 the release notes和文档。

升级,8.2 is obsolete .

关于postgresql - 使用 desc 在 postgresql 上创建索引时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24011561/

相关文章:

sql - 具有不同代码的重复记录。选择没有 'useful' 且至少有一个 'not found' 的代码

postgresql - 带有 ORDER BY 的 Postgres UPDATE,怎么做?

jquery .each 仅适用于第一个元素

indexing - 在抓取我们的网站时,Google 是否会忽略哈希片段 (#) 之后的内容?

php - 创建一个 INDEX 以改善由 ORDER BY 导致的缓慢执行时间

python - 使用 Vagrant 托管 PostgreSQL 数据库时如何找到我的同步文件夹?

python - 如何在 Python Django 中附加到数组字段

非密集索引的数据库查询

git - 如何解决 git-svn 索引不匹配问题?

sql - 第 2 部分 : how to get the Sum of a partition based query without actually pivoting