Re: BLOBs - Mailing list pgsql-sql

From Andreas Joseph Krogh
Subject Re: BLOBs
Date
Msg-id VisenaEmail.a5.57089a2d41817e3c.152519d26b3@tc7-visena
Whole thread Raw
In response to Re: BLOBs  (Eugene Yin <eugeneymail@ymail.com>)
Responses Re: BLOBs
List pgsql-sql
På søndag 17. januar 2016 kl. 20:26:34, skrev Eugene Yin <eugeneymail@ymail.com>:
 
BLOB binary large object see Large Object Support
 
 
  •  Minuses
  • must use different interface from what is normally used to access BLOBs.
  • Need to track OID. Normally a separate table with additional meta data is used to describe what each OID is.
  • (8.4 and <8.4) No access controls in database.
  • Sometimes advised against (basically you only need them if your entry is so large you need/want to seek and read bits and pieces of it at a time). 
 
 
Do one really: 
  • Need to track OID. Normally a separate table with additional meta data is used to describe what each OID is.
 
Using BLOBs and PG's OIDs is really simple if you use the pgjdbc-ng driver.
 
You column has to be defined as type=OID, like this
 
CREATE TABLE my_stuff(
id SERIAL PRIMARY KEY,
data OID
);
 
Then use the JDBC BLOB-interface as defined.
 
You don't need to do anything else except running the 'vacuumlo' system-command (not SQL-command) once in a while, preferably using 'cron' or some other scheduling-tool.
 
Note that "everything" you read about PG and JDBC and BLOB will describe the official JDBC-driver, which doesn't even support BLOBs. So if you just get by that and use the pgjdbc-ng driver your life will be much simpler.
 
--
Andreas Joseph Krogh
CTO / Partner - Visena AS
Mobile: +47 909 56 963
 
Attachment

pgsql-sql by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: BYTEA
Next
From: Andreas Joseph Krogh
Date:
Subject: Re: BYTEA