agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: Andreas Joseph Krogh <andreas@visena.com>
To: pgsql-sql@postgresql.org
Subject: Re: BLOBs
Date: Sun, 17 Jan 2016 23:08:06 +0100 (CET)
Message-ID: <VisenaEmail.a5.57089a2d41817e3c.152519d26b3@tc7-visena> (raw)
In-Reply-To: <825207667.6348678.1453058794606.JavaMail.yahoo@mail.yahoo.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>

På søndag 17. januar 2016 kl. 20:26:34, skrev Eugene Yin <eugeneymail@ymail.com 
<mailto:eugeneymail@ymail.com>>:
 
BLOB binary large object see Large Object Support 
<http://www.postgresql.org/docs/current/static/largeobjects.html;
 
 

 *  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 
<http://www.postgresql.org/message-id/20150129142450.b83ce5d0652c39791292d0d5@potentialtech.com;
 (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).  
https://wiki.postgresql.org/wiki/BinaryFilesInDB 
<https://wiki.postgresql.org/wiki/BinaryFilesInDB;
 
 
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
andreas@visena.com <mailto:andreas@visena.com>
www.visena.com <https://www.visena.com;
 <https://www.visena.com;


 

view thread (20+ messages)  latest in thread

Message-ID: <VisenaEmail.a5.57089a2d41817e3c.152519d26b3@tc7-visena>
Permalink:  ../VisenaEmail.a5.57089a2d41817e3c.152519d26b3@tc7-visena/
Also on:    postgresql.org/message-id/VisenaEmail.a5.57089a2d41817e3c.152519d26b3@tc7-visena

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: andreas@visena.com
  Subject: Re: BLOBs
  In-Reply-To: <VisenaEmail.a5.57089a2d41817e3c.152519d26b3@tc7-visena>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox