⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readme.lo

📁 PostgreSQL 8.2中增加了很多企业用户所需要的功能和性能上的提高,其开发团队说,该版本将加速更多企业向该数据库移植.核心开发成员之一Bruce Momjian表示,在新版PostgreSQL
💻 LO
字号:
PostgreSQL type extension for managing Large Objects----------------------------------------------------OverviewOne of the problems with the JDBC driver (and this affects the ODBC driveralso), is that the specification assumes that references to BLOBS (BinaryLarge OBjectS) are stored within a table, and if that entry is changed, theassociated BLOB is deleted from the database.As PostgreSQL stands, this doesn't occur.  Large objects are treated asobjects in their own right; a table entry can reference a large object byOID, but there can be multiple table entries referencing the same largeobject OID, so the system doesn't delete the large object just because youchange or remove one such entry.Now this is fine for new PostgreSQL-specific applications, but existing onesusing JDBC or ODBC won't delete the objects, resulting in orphaning - objectsthat are not referenced by anything, and simply occupy disk space.The FixI've fixed this by creating a new data type 'lo', some support functions, anda Trigger which handles the orphaning problem.  The trigger essentially justdoes a 'lo_unlink' whenever you delete or modify a value referencing a largeobject.  When you use this trigger, you are assuming that there is only onedatabase reference to any large object that is referenced in atrigger-controlled column!The 'lo' type was created because we needed to differentiate between plainOIDs and Large Objects. Currently the JDBC driver handles this dilemma easily,but (after talking to Byron), the ODBC driver needed a unique type. They hadcreated an 'lo' type, but not the solution to orphaning.You don't actually have to use the 'lo' type to use the trigger, but it may beconvenient to use it to keep track of which columns in your database representlarge objects that you are managing with the trigger.InstallOk, first build the shared library, and install. Typing 'make install' in thecontrib/lo directory should do it.Then, as the postgres super user, run the lo.sql script in any database thatneeds the features. This will install the type, and define the supportfunctions.  You can run the script once in template1, and the objects will beinherited by subsequently-created databases.How to UseThe easiest way is by an example:> create table image (title text, raster lo);> create trigger t_raster before update or delete on image>   for each row execute procedure lo_manage(raster);Create a trigger for each column that contains a lo type, and give the columnname as the trigger procedure argument.  You can have more than one trigger ona table if you need multiple lo columns in the same table, but don't forget togive a different name to each trigger.Issues* Dropping a table will still orphan any objects it contains, as the trigger  is not executed.  Avoid this by preceding the 'drop table' with 'delete from {table}'.  If you already have, or suspect you have, orphaned large objects, see  the contrib/vacuumlo module to help you clean them up.  It's a good idea  to run contrib/vacuumlo occasionally as a back-stop to the lo_manage  trigger.* Some frontends may create their own tables, and will not create the  associated trigger(s). Also, users may not remember (or know) to create  the triggers.As the ODBC driver needs a permanent lo type (& JDBC could be optimised touse it if it's Oid is fixed), and as the above issues can only be fixed bysome internal changes, I feel it should become a permanent built-in type.I'm releasing this into contrib, just to get it out, and tested.Peter Mount <peter@retep.org.uk> June 13 1998

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -