如何比较postgresql中的ctid?
我正在尝试用postgresql学习SQL。我要选择具有受尊重的ctid的特定行。我该怎么做 当我运行以下查询时:-如何比较postgresql中的ctid?,sql,postgresql,comparison,Sql,Postgresql,Comparison,我正在尝试用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) ^ HIN
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)
:
我认为值得注意的是,
ctid
是一个字符串,其字符串表示形式是括号中的一对数字。
#= select ctid,* from t where ctid = '(0,1)';
┌───────┬───┐
│ ctid │ i │
├───────┼───┤
│ (0,1) │ 1 │
└───────┴───┘
(1 row)