ALTER LARGE OBJECT
是一个DDL命令,用于更改大型对象的所有权。
ALTER LARGE OBJECT
添加于PostgreSQL 9.0。
更改历史
- PostgreSQL 14
ALTER LARGE OBJECT ... OWNER TO CURRENT_ROLE
语法添加 (提交 45b98057)
- PostgreSQL 9.5
ALTER LARGE OBJECT ... OWNER TO { CURRENT_USER | SESSION_USER }
语法添加 (提交 31eae602)
- PostgreSQL 9.0
- 添加 (提交 f1325ce2)
示例
使用ALTER LARGE OBJECT
更改大型对象的所有权
postgres=# \lo_import /tmp/random-meme.gif 'popular animated meme' lo_import 16459 postgres=# \dl Large objects ID | Owner | Description -------+----------+---------------------- 16459 | postgres | popular animated meme (1 row) postgres=# ALTER LARGE OBJECT 16459 OWNER TO lo_usr; ALTER LARGE OBJECT postgres=# \dl Large objects ID | Owner | Description -------+--------+---------------------- 16459 | lo_usr | popular animated meme (1 row)
参考
- PostgreSQL 文档: ALTER LARGE OBJECT