pg_largeobject
是一个包含大型对象 (LO) 数据的系统目录表。
pg_largeobject
在PostgreSQL 7.1 中添加。
psql 命令
\dl
或 \lo_list
列出可用的大型对象。
按 PostgreSQL 版本定义
pg_largeobject (PostgreSQL 17)
Table "pg_catalog.pg_largeobject" Column | Type | Collation | Nullable | Default --------+---------+-----------+----------+--------- loid | oid | | not null | pageno | integer | | not null | data | bytea | | not null | Indexes: "pg_largeobject_loid_pn_index" PRIMARY KEY, btree (loid, pageno)
文档: pg_largeobject
pg_largeobject (PostgreSQL 16)
Table "pg_catalog.pg_largeobject" Column | Type | Collation | Nullable | Default --------+---------+-----------+----------+--------- loid | oid | | not null | pageno | integer | | not null | data | bytea | | not null | Indexes: "pg_largeobject_loid_pn_index" PRIMARY KEY, btree (loid, pageno)
文档: pg_largeobject
pg_largeobject (PostgreSQL 15)
Table "pg_catalog.pg_largeobject" Column | Type | Collation | Nullable | Default --------+---------+-----------+----------+--------- loid | oid | | not null | pageno | integer | | not null | data | bytea | | not null | Indexes: "pg_largeobject_loid_pn_index" PRIMARY KEY, btree (loid, pageno)
文档: pg_largeobject
pg_largeobject (PostgreSQL 14)
Table "pg_catalog.pg_largeobject" Column | Type | Collation | Nullable | Default --------+---------+-----------+----------+--------- loid | oid | | not null | pageno | integer | | not null | data | bytea | | not null | Indexes: "pg_largeobject_loid_pn_index" PRIMARY KEY, btree (loid, pageno)
文档: pg_largeobject
pg_largeobject (PostgreSQL 13)
Table "pg_catalog.pg_largeobject" Column | Type | Collation | Nullable | Default --------+---------+-----------+----------+--------- loid | oid | | not null | pageno | integer | | not null | data | bytea | | not null | Indexes: "pg_largeobject_loid_pn_index" UNIQUE, btree (loid, pageno)
文档: pg_largeobject
pg_largeobject (PostgreSQL 12)
Table "pg_catalog.pg_largeobject" Column | Type | Collation | Nullable | Default --------+---------+-----------+----------+--------- loid | oid | | not null | pageno | integer | | not null | data | bytea | | not null | Indexes: "pg_largeobject_loid_pn_index" UNIQUE, btree (loid, pageno)
文档: pg_largeobject
pg_largeobject (PostgreSQL 11)
Table "pg_catalog.pg_largeobject" Column | Type | Collation | Nullable | Default --------+---------+-----------+----------+--------- loid | oid | | not null | pageno | integer | | not null | data | bytea | | not null | Indexes: "pg_largeobject_loid_pn_index" UNIQUE, btree (loid, pageno)
文档: pg_largeobject
pg_largeobject (PostgreSQL 10)
Table "pg_catalog.pg_largeobject" Column | Type | Collation | Nullable | Default --------+---------+-----------+----------+--------- loid | oid | | not null | pageno | integer | | not null | data | bytea | | not null | Indexes: "pg_largeobject_loid_pn_index" UNIQUE, btree (loid, pageno)
文档: pg_largeobject
pg_largeobject (PostgreSQL 9.6)
Table "pg_catalog.pg_largeobject" Column | Type | Modifiers --------+---------+----------- loid | oid | not null pageno | integer | not null data | bytea | not null Indexes: "pg_largeobject_loid_pn_index" UNIQUE, btree (loid, pageno)
文档: pg_largeobject
pg_largeobject (PostgreSQL 9.5)
Table "pg_catalog.pg_largeobject" Column | Type | Modifiers --------+---------+----------- loid | oid | not null pageno | integer | not null data | bytea | not null Indexes: "pg_largeobject_loid_pn_index" UNIQUE, btree (loid, pageno)
文档: pg_largeobject
pg_largeobject (PostgreSQL 9.4)
Table "pg_catalog.pg_largeobject" Column | Type | Modifiers --------+---------+----------- loid | oid | not null pageno | integer | not null data | bytea | Indexes: "pg_largeobject_loid_pn_index" UNIQUE, btree (loid, pageno)
文档: pg_largeobject
pg_largeobject (PostgreSQL 9.3)
Table "pg_catalog.pg_largeobject" Column | Type | Modifiers --------+---------+----------- loid | oid | not null pageno | integer | not null data | bytea | Indexes: "pg_largeobject_loid_pn_index" UNIQUE, btree (loid, pageno)
文档: pg_largeobject
pg_largeobject (PostgreSQL 9.2)
Table "pg_catalog.pg_largeobject" Column | Type | Modifiers --------+---------+----------- loid | oid | not null pageno | integer | not null data | bytea | Indexes: "pg_largeobject_loid_pn_index" UNIQUE, btree (loid, pageno)
文档: pg_largeobject
pg_largeobject (PostgreSQL 9.1)
Table "pg_catalog.pg_largeobject" Column | Type | Modifiers --------+---------+----------- loid | oid | not null pageno | integer | not null data | bytea | Indexes: "pg_largeobject_loid_pn_index" UNIQUE, btree (loid, pageno)
文档: pg_largeobject
pg_largeobject (PostgreSQL 9.0)
Table "pg_catalog.pg_largeobject" Column | Type | Modifiers --------+---------+----------- loid | oid | not null pageno | integer | not null data | bytea | Indexes: "pg_largeobject_loid_pn_index" UNIQUE, btree (loid, pageno)
文档: pg_largeobject
pg_largeobject (PostgreSQL 8.4)
Table "pg_catalog.pg_largeobject" Column | Type | Modifiers --------+---------+----------- loid | oid | not null pageno | integer | not null data | bytea | Indexes: "pg_largeobject_loid_pn_index" UNIQUE, btree (loid, pageno)
文档: pg_largeobject
pg_largeobject (PostgreSQL 8.3)
Table "pg_catalog.pg_largeobject" Column | Type | Modifiers --------+---------+----------- loid | oid | not null pageno | integer | not null data | bytea | Indexes: "pg_largeobject_loid_pn_index" UNIQUE, btree (loid, pageno)
文档: pg_largeobject
pg_largeobject (PostgreSQL 8.2)
Table "pg_catalog.pg_largeobject" Column | Type | Modifiers --------+---------+----------- loid | oid | not null pageno | integer | not null data | bytea | Indexes: "pg_largeobject_loid_pn_index" UNIQUE, btree (loid, pageno)
文档: pg_largeobject
更改历史记录
- PostgreSQL 9.5
- 列
data
设置为NOT NULL
(提交 82a532b3)
- 列
- PostgreSQL 7.1
- 添加 (提交 cf5a950c)
示例
pg_largeobject
的基本用法(使用psql 的大型对象斜杠命令)
postgres=# SELECT * FROM pg_largeobject; loid | pageno | data ------+--------+------ (0 rows) postgres=# \lo_import /tmp/hello-world.txt lo_import 16455 postgres=# SELECT * FROM pg_largeobject; loid | pageno | data -------+--------+------------------------------ 16455 | 0 | \x48656c6c6f20776f726c64210a (1 row) postgres=# \lo_unlink 16455 lo_unlink 16455 postgres=# SELECT * FROM pg_largeobject; loid | pageno | data ------+--------+------ (0 rows)
参考
- PostgreSQL 文档: pg_largeobject