Skip site navigation (1) Skip section navigation (2)

Re: Storing Binary Large Objects

From: "David E(dot) Wheeler" <david(at)kineticode(dot)com>
To: Mark Wong <markwkm(at)gmail(dot)com>
Cc: "Rich Shepard" <rshepard(at)appl-ecosys(dot)com>, pdxpug(at)postgresql(dot)org
Subject: Re: Storing Binary Large Objects
Date: 2007-03-29 18:00:25
Message-ID: E11F5DEA-9371-4C30-A7D8-29AA982EDE0B@kineticode.com (view raw or flat)
Thread:
Lists: pdxpug
On Mar 29, 2007, at 08:35, Mark Wong wrote:

> On paper, using bytea looks more straightforward the oid datatype.
> Does bytea have its own difficulties, other than having to find a way
> to escape the data?

Only that it's not chunked, so when you do a select, you get the  
entire data back, not just a pointer. That's the primary difference,  
AFAIK.

Tools like DBD::Pg do the escaping for you, provided you tell them  
that it's bytea:

   my $sth = $dbh->prepare('INSERT INTO foo (bytea_col) VALUES(?)');
   $sth->bind_param(1, $binary_data, { pg_type => DBD::Pg::PG_BYTEA });
   $sth->execute;

Best,

David

In response to

pdxpug by date

Next:From: Thomas J KellerDate: 2007-03-30 17:38:06
Subject: data integrity
Previous:From: Ian BurrellDate: 2007-03-29 17:37:13
Subject: Re: Storing Binary Large Objects

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group