繁体   English   中英

如何比较PostgreSQL中的ctid?

[英]how to compare ctid in postgresql?

我正在尝试使用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中比较ctid?

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

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM