W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗值獎勵
create
tablename
tableoid
[bootstrap
]
[shared_relation
]
[rowtype_oid
oid
]
(name1
=
type1
[FORCE NOT NULL
| FORCE NULL
] [,
name2
=
type2
[FORCE NOT NULL
| FORCE NULL
],
...])
創(chuàng)建一個叫做tablename
,OID為tableoid
的表,它的列在圓括弧中給出。
bootstrap.c
直接支持下列列類型:bool
、bytea
、char
(1 字節(jié))、name
、int2
、int4
、
regproc
、regclass
、regtype
、text
、oid
、tid
、xid
、cid
、int2vector
、
oidvector
、_int4
(數(shù)組)、_text
(數(shù)組)、_oid
(數(shù)組)、_char
(數(shù)組)、_aclitem
(數(shù)組)。盡管我們可以創(chuàng)建包含其它類型列的表, 但是我們只有在創(chuàng)建完pg_type
并且填充了合適的記錄之后才行(這實際上就意味著在自舉目錄中,只能使用這些列類型,而非自舉目錄可以使用任意內(nèi)置類型)。
如果聲明了bootstrap
,那么該表將只在磁盤上創(chuàng)建;不會向pg_class
、pg_attribute
等表里面輸入任何與該表相關(guān)的東西。因此這樣的表將無法被普通的SQL操作訪問,直到那些記錄被用硬辦法(用insert
命令)建立。 這個選項用于創(chuàng)建
pg_class
等表本身。
如果聲明了shared_relation
,那么表就作為共享表創(chuàng)建。除非聲明了without_oids
,否則表將會有OID。表的行類型OID(pg_type
的OID)可以有選擇性地通過rowtype_oid
子句指定。如果沒有指定,會為之自產(chǎn)生一個OID(如果
bootstrap
被指定,則rowtype_oid
是無效的,但不管怎樣它還是被寫在了文檔中)。
open
tablename
打開名為tablename
的表進行數(shù)據(jù)插入。任何當前打開的表將被關(guān)閉。
close
[tablename
]
關(guān)閉打開著的表。給出的表名用于交叉檢查,但并不是必須的。
insert
(
[oid_value
] value1
value2
... )
用value1
、value2
等作為列值向打開的表插入一條新記錄。
NULL 可以用特殊的關(guān)鍵字_null_
指定。看起來不像標識符或者數(shù)字字符串的值必須被加上雙引號。
declare
[unique
]
index
indexname
indexoid
on
tablename
using
amname
(
opclass1
name1
[, ...] )
在名為tablename
的表上用amname
訪問方法創(chuàng)建一個OID為indexoid
的名為indexname
的索引。 索引的域被稱為name1
、
name2
等,而使用的操作符類分別是opclass1
, opclass2
等。 該命令將會創(chuàng)建索引文件和適當?shù)南到y(tǒng)目錄項,但是索引內(nèi)容不會被此命令初始化。
declare toast
toasttableoid
toastindexoid
on
tablename
為名為tablename
的表創(chuàng)建一個TOAST表。該TOAST表將被賦予由toasttableoid
表示的OID,且它的索引將被賦予由toastindexoid
表示的OID。和declare index
一樣,索引的填充將被推遲。
build indices
填充之前聲明的索引。
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: