[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Proposal for file attachment API



On Mon, Jul 4, 2011 at 7:21 PM, Luke <..hidden..> wrote:
> On Mon, 4 Jul 2011, Chris Travers wrote:
>
>> CREATE TABLE file_storage (
>> content bytea,
>> mime_type int,
>> id serial not null unique,
>> PRIMARY KEY (content, mime_type),
>> );
>
> Aside from everything:
>
> Should mime_type be an int?  What are you going to be putting in it?
>
> How can we be sure that the referent of that int doesn't change at some
> later date?

PostgreSQL's referential integrity checking will prevent a change to
any foreign key that is currently referenced.  If we wanted to, we
could cascade changes, but I prefer not to do that unless absolutely
needed.

One can create additional x- mime types as needed.  We'd probably have
to have a lookup table anyway, and int's would use less space.  Not
unless we want to treat text/htlm as a valid MIME type ;-)

Best wishes,
Chris Travers