Re: [GENERAL] Storing images as BYTEA or large objects

2008-02-14 Thread John DeSoi
On Feb 13, 2008, at 2:53 PM, Koen Vermeer wrote: I'll check to see what the options are for reading in the data in PHP. Thanks for the help! If you use prepared statements, you don't need to do anything special at all for bytea with PHP. No worries about escaping and all that. Using the

Re: [GENERAL] Storing images as BYTEA or large objects

2008-02-13 Thread Koen Vermeer
Op woensdag 13-02-2008 om 10:45 uur [tijdzone -0300], schreef Alvaro Herrera: > > Instead of base64 encoding, I guess it would be easier to just escape > > the required bytes and store them in a bytea. > Actually, if you have access to the pqExecParams() call, you can pass > the bytes to a bytea co

Re: [GENERAL] Storing images as BYTEA or large objects

2008-02-13 Thread Koen Vermeer
Op woensdag 13-02-2008 om 15:21 uur [tijdzone +], schreef Peter Wilson: > > Right, so that basically means that when 'large objects' are files, > > which should be saved and restored as a whole, it may be more natural to > > use the large objects. I guess that applies to some uses of media > >

Re: [GENERAL] Storing images as BYTEA or large objects

2008-02-13 Thread Peter Wilson
Koen Vermeer wrote: On Wed, 2008-02-13 at 09:35 +, Peter Wilson wrote: My preference : if I don't need the file-like interface to large objects I'd use BYTEA every time. Right, so that basically means that when 'large objects' are files, which should be saved and restored as a whol

Re: [GENERAL] Storing images as BYTEA or large objects

2008-02-13 Thread Alvaro Herrera
Koen Vermeer wrote: > The large-objects-are-actually-files thing applies to my situation, so > unless there is some 'large objects are / will be deprecated' argument, > I guess I stick with large objects. Certainly there is no such argument. -- Alvaro Herrerahttp

Re: [GENERAL] Storing images as BYTEA or large objects

2008-02-13 Thread Koen Vermeer
On Wed, 2008-02-13 at 09:35 +, Peter Wilson wrote: > I've used both methods. The only real problem is that none of the > trigger based replication schemes > such as Slony can't deal with large objects. I can live with that for now. If the project ever gets that big, I probably need to rethink

Re: [GENERAL] Storing images as BYTEA or large objects

2008-02-13 Thread Alvaro Herrera
Koen Vermeer wrote: > Instead of base64 encoding, I guess it would be easier to just escape > the required bytes and store them in a bytea. Actually, if you have access to the pqExecParams() call, you can pass the bytes to a bytea column unescaped, which AFAIK saves some processing on both the cl

Re: [GENERAL] Storing images as BYTEA or large objects

2008-02-13 Thread Peter Wilson
Koen Vermeer wrote: Hi, I would like to store binary data in a PostgreSQL database. The size of the data is about 2 to 20 MB and is always stored or retrieved as a block (i.e., I do not need to get only part of the data). As I understand, I have two options for storing this data: As BYTEA or as

Re: [GENERAL] Storing images as BYTEA or large objects

2008-02-13 Thread Koen Vermeer
On Wed, 2008-02-13 at 09:57 +0100, Gevik Babakhani wrote: > In hour case we where switching between databases so what I have done in the > past was: > For inserting: > 1. create a TEXT column in my table. (In PG this can be 1GB in size) > 2. read file contents in a buffer/string and Base64 encode

Re: [GENERAL] Storing images as BYTEA or large objects

2008-02-13 Thread Gevik Babakhani
ject: Re: [GENERAL] Storing images as BYTEA or large objects > > On Tue, 2008-02-12 at 17:16 -0700, Leonel Nunez wrote: > > > My two questions are: Is this summary correct? And: Which method > > > should I choose? > > With Java , Python , Perl you've got funct

Re: [GENERAL] Storing images as BYTEA or large objects

2008-02-13 Thread Koen Vermeer
On Tue, 2008-02-12 at 21:14 -0600, Andy Colson wrote: > Having used the large objects, I can tell you they do backup (pg_dump, > etc) and they are not hard to use. There is even a contrib that helps > you hook them up to a table so they get deleted/etc at appropriate times > (I have not used it

Re: [GENERAL] Storing images as BYTEA or large objects

2008-02-13 Thread Koen Vermeer
On Tue, 2008-02-12 at 17:16 -0700, Leonel Nunez wrote: > > My two questions are: Is this summary correct? And: Which method should > > I choose? > With Java , Python , Perl you've got functions that escapes the data for > you What about C++ and PHP? Koen ---(end of bro

Re: [GENERAL] Storing images as BYTEA or large objects

2008-02-13 Thread Koen Vermeer
On Wed, 2008-02-13 at 07:37 +0100, Gevik Babakhani wrote: > Which programming language are you using? That would be C++ for storing and both C++ and PHP for retrieving the data. Maybe also PL/SQL for retrieval (in addition to or instead of PHP). Koen ---(end of broadcast

Re: [GENERAL] Storing images as BYTEA or large objects

2008-02-12 Thread Gevik Babakhani
age- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Koen Vermeer > Sent: Tuesday, February 12, 2008 11:41 PM > To: pgsql-general@postgresql.org > Subject: [GENERAL] Storing images as BYTEA or large objects > > Hi, > > I would like to store binary data in

Re: [GENERAL] Storing images as BYTEA or large objects

2008-02-12 Thread Tom Lane
"Adam Rich" <[EMAIL PROTECTED]> writes: >>> I have two options for storing this data: As BYTEA or as large objects. > Is it true that if you update a row containing a large BYTEA value, (even if > you're not updating the BYTEA field itself, just another field), it requires > the entire BYTEA valu

Re: [GENERAL] Storing images as BYTEA or large objects

2008-02-12 Thread Adam Rich
> > I have two options for storing this data: As BYTEA or as large objects. Is it true that if you update a row containing a large BYTEA value, (even if you're not updating the BYTEA field itself, just another field), it requires the entire BYTEA value to be copied to a new row (because of MVCC)

Re: [GENERAL] Storing images as BYTEA or large objects

2008-02-12 Thread Andy Colson
Koen Vermeer wrote: Hi, I would like to store binary data in a PostgreSQL database. The size of the data is about 2 to 20 MB and is always stored or retrieved as a block (i.e., I do not need to get only part of the data). As I understand, I have two options for storing this data: As BYTEA or as

Re: [GENERAL] Storing images as BYTEA or large objects

2008-02-12 Thread Leonel Nunez
> Hi, > > I would like to store binary data in a PostgreSQL database. The size of > the data is about 2 to 20 MB and is always stored or retrieved as a > block (i.e., I do not need to get only part of the data). As I > understand, I have two options for storing this data: As BYTEA or as > large obj

[GENERAL] Storing images as BYTEA or large objects

2008-02-12 Thread Koen Vermeer
Hi, I would like to store binary data in a PostgreSQL database. The size of the data is about 2 to 20 MB and is always stored or retrieved as a block (i.e., I do not need to get only part of the data). As I understand, I have two options for storing this data: As BYTEA or as large objects. As I un