您好,登錄后才能下訂單哦!
這篇文章主要介紹“PostgreSQL的OID類型是什么”,在日常操作中,相信很多人在PostgreSQL的OID類型是什么問題上存在疑惑,小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”PostgreSQL的OID類型是什么”的疑惑有所幫助!接下來,請跟著小編一起來學習吧!
OID定義為無符號整型數(shù)字,PG內(nèi)置了轉換函數(shù)從regproc, regprocedure, regoper, regoperator, regclass, regtype, regrole, regnamespace, regconfig, and regdictionary這些類型轉換為OID.
TODO
下面是一些例子:
查詢某張表的屬性
[local]:5432 pg12@testdb=# SELECT * FROM pg_attribute WHERE attrelid = (SELECT oid FROM pg_class WHERE relname = 'tbl') limit 1; -[ RECORD 1 ]-+--------- attrelid | 32774 attname | tableoid atttypid | 26 attstattarget | 0 attlen | 4 attnum | -6 attndims | 0 attcacheoff | -1 atttypmod | -1 attbyval | t attstorage | p attalign | i attnotnull | t atthasdef | f atthasmissing | f attidentity | attgenerated | attisdropped | f attislocal | t attinhcount | 0 attcollation | 0 attacl | attoptions | attfdwoptions | attmissingval | Time: 5.209 ms --> [local]:5432 pg12@testdb=# SELECT * FROM pg_attribute where attrelid = 'tbl'::regclass limit 1; -[ RECORD 1 ]-+--------- attrelid | 32774 attname | tableoid atttypid | 26 attstattarget | 0 attlen | 4 attnum | -6 attndims | 0 attcacheoff | -1 atttypmod | -1 attbyval | t attstorage | p attalign | i attnotnull | t atthasdef | f atthasmissing | f attidentity | attgenerated | attisdropped | f attislocal | t attinhcount | 0 attcollation | 0 attacl | attoptions | attfdwoptions | attmissingval | Time: 1.205 ms
查詢操作符+的相關信息
[local]:5432 pg12@testdb=# select * from pg_operator where oid='+(int,float)'::regoperator; ERROR: operator does not exist: +(int,float) LINE 1: select * from pg_operator where oid='+(int,float)'::regopera... ^ Time: 1.502 ms [local]:5432 pg12@testdb=# select * from pg_operator where oid='+(float,float)'::regoperator; -[ RECORD 1 ]+--------- oid | 591 oprname | + oprnamespace | 11 oprowner | 10 oprkind | b oprcanmerge | f oprcanhash | f oprleft | 701 oprright | 701 oprresult | 701 oprcom | 591 oprnegate | 0 oprcode | float8pl oprrest | - oprjoin | - Time: 3.446 ms
注意:操作符需指定參數(shù).
到此,關于“PostgreSQL的OID類型是什么”的學習就結束了,希望能夠解決大家的疑惑。理論與實踐的搭配能更好的幫助大家學習,快去試試吧!若想繼續(xù)學習更多相關知識,請繼續(xù)關注億速云網(wǎng)站,小編會繼續(xù)努力為大家?guī)砀鄬嵱玫奈恼拢?/p>
免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權內(nèi)容。