Skip to content

Latest commit

 

History

History
196 lines (84 loc) · 6.36 KB

20130510_02.md

File metadata and controls

196 lines (84 loc) · 6.36 KB

大对象 - PostgreSQL 9.3 Add API for 64-bit large object access

作者

digoal

日期

2013-05-10

标签

PostgreSQL , 64位大对象接口 , libpq


背景

Increase the maximum length of large objects from 2GB to 4TB (Nozomi Anzai, Yugo Nagata)  
This change includes new libpq and server-side 64-bit-capable large object access functions.  
Add API for 64-bit large object access.  Now users can access up to  
4TB large objects (standard 8KB BLCKSZ case).  For this purpose new  
libpq API lo_lseek64, lo_tell64 and lo_truncate64 are added.  Also  
corresponding new backend functions lo_lseek64, lo_tell64 and  
lo_truncate64 are added. inv_api.c is changed to handle 64-bit  
offsets.  
  
Patch contributed by Nozomi Anzai (backend side) and Yugo Nagata  
(frontend side, docs, regression tests and example program). Reviewed  
by Kohei Kaigai. Committed by Tatsuo Ishii with minor editings.  

PostgreSQL 9.3 新增了64位的大对象访问接口函数如下

src/interfaces/libpq/fe-lobj.c

lo_lseek64, lo_tell64 and lo_truncate64.

同时新增了服务端64位函数.

src/backend/libpq/be-fsstubs.c

digoal=# \df *.*lo_*  
                                 List of functions  
   Schema   |     Name      | Result data type |    Argument data types    |  Type    
------------+---------------+------------------+---------------------------+--------  
 pg_catalog | lo_close      | integer          | integer                   | normal  
 pg_catalog | lo_creat      | oid              | integer                   | normal  
 pg_catalog | lo_create     | oid              | oid                       | normal  
 pg_catalog | lo_export     | integer          | oid, text                 | normal  
 pg_catalog | lo_import     | oid              | text                      | normal  
 pg_catalog | lo_import     | oid              | text, oid                 | normal  
 pg_catalog | lo_lseek      | integer          | integer, integer, integer | normal  
 pg_catalog | lo_lseek64    | bigint           | integer, bigint, integer  | normal  
 pg_catalog | lo_open       | integer          | oid, integer              | normal  
 pg_catalog | lo_tell       | integer          | integer                   | normal  
 pg_catalog | lo_tell64     | bigint           | integer                   | normal  
 pg_catalog | lo_truncate   | integer          | integer, integer          | normal  
 pg_catalog | lo_truncate64 | integer          | integer, bigint           | normal  
 pg_catalog | lo_unlink     | integer          | oid                       | normal  
(14 rows)  

大对象的服务端使用可参考 :

http://blog.163.com/digoal@126/blog/static/16387704020130931040444/

http://blog.163.com/digoal@126/blog/static/1638770402013264951552/

参考

1. http://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=461ef73f0977c95c9452680495bc161618db9227

2. http://blog.163.com/digoal@126/blog/static/16387704020130931040444/

3. http://blog.163.com/digoal@126/blog/static/1638770402013264951552/

4. 16 files changed:

doc/src/sgml/lobj.sgml		diff | blob | blame | history  
src/backend/libpq/be-fsstubs.c		diff | blob | blame | history  
src/backend/storage/large_object/inv_api.c		diff | blob | blame | history  
src/backend/utils/errcodes.txt		diff | blob | blame | history  
src/include/catalog/pg_proc.h		diff | blob | blame | history  
src/include/libpq/be-fsstubs.h		diff | blob | blame | history  
src/include/postgres_ext.h		diff | blob | blame | history  
src/include/storage/large_object.h		diff | blob | blame | history  
src/interfaces/libpq/exports.txt		diff | blob | blame | history  
src/interfaces/libpq/fe-lobj.c		diff | blob | blame | history  
src/interfaces/libpq/libpq-fe.h		diff | blob | blame | history  
src/interfaces/libpq/libpq-int.h		diff | blob | blame | history  
src/test/examples/Makefile		diff | blob | blame | history  
src/test/examples/testlo64.c	[new file with mode: 0644]	blob  
src/test/regress/input/largeobject.source		diff | blob | blame | history  
src/test/regress/output/largeobject.source		diff | blob | blame | history  

5. http://www.postgresql.org/docs/devel/static/lo-interfaces.html

您的愿望将传达给PG kernel hacker、数据库厂商等, 帮助提高数据库产品质量和功能, 说不定下一个PG版本就有您提出的功能点. 针对非常好的提议,奖励限量版PG文化衫、纪念品、贴纸、PG热门书籍等,奖品丰富,快来许愿。开不开森.

digoal's wechat