【问题标题】:how to compare ctid in postgresql?如何比较postgresql中的ctid?
【发布时间】:2018-12-02 06:15:29
【问题描述】:

我正在尝试使用 postgresql 学习 SQL。我想选择具有尊重 ctid 的特定行。我该怎么做?

当我运行以下查询时:-

select ctid,* from t01 where ctid = (0,11);

我收到此错误:-

operator does not exist: tid = record
LINE 1: select ctid,* from t01 where ctid = (0,11)
                                          ^
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.

那么如何比较 (postgre)sql 中的 ctids 呢?

【问题讨论】:

    标签: sql postgresql comparison


    【解决方案1】:

    你可以简单地使用= '(0,1)':

    #= select ctid,* from t where ctid = '(0,1)';
    ┌───────┬───┐
    │ ctid  │ i │
    ├───────┼───┤
    │ (0,1) │ 1 │
    └───────┴───┘
    (1 row)
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-21
    • 2020-10-04
    • 2012-06-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多