Re: Storing images in PostgreSQL databases (again)

From: "Merlin Moncure" <mmoncure(at)gmail(dot)com>
To: "Jean-Christophe Roux" <jcxxr(at)yahoo(dot)com>
Cc: "Alexander Staubo" <alex(at)purefiction(dot)net>, pgsql-general(at)postgresql(dot)org
Subject: Re: Storing images in PostgreSQL databases (again)
Date: 2006-10-06 19:16:53
Message-ID: b42b73150610061216h5a21f5abv25b3d6d5705feeaf@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 10/5/06, Jean-Christophe Roux <jcxxr(at)yahoo(dot)com> wrote:
>
> Why would I set a bytea column (containing picures) as a primary key?
> Because I want to be sure that the same image is inserted only once (that
> requirement comes from a real project) and using a primary key for that
> purpose makes sense to me.
> Am I going to retrieve an image row by its image data? I would certainly
> like! For instance, I would like to get the pictures whose main color is
> green (requirement from a real project), and a
> select * from images where main_color(image) = 'green' would be nice.
> JCR

standard postgresql indexes use a btree which would be completely
impractical to index bitmaps. what you would want is a hand rigged
unqiue constraint which is combination of insert trigger and hash
algorithm plus some code to resolve collisions. this is what i would
do if bitmaps were stored in/out of the database.

merlin

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jacob Coby 2006-10-06 19:20:51 Re: Storing images in PostgreSQL databases (again)
Previous Message Tom Lane 2006-10-06 19:16:19 Re: URGENT - startup process (PID 29541) was terminated by signal 6