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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Browse pdxpug by date

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