Re: what is the best way of storing text+image documents in postgresql

Поиск
Список
Период
Сортировка
От Craig Ringer
Тема Re: what is the best way of storing text+image documents in postgresql
Дата
Msg-id 4DEF73F1.9030101@postnewspapers.com.au
обсуждение исходный текст
Ответ на what is the best way of storing text+image documents in postgresql  (Arash pajoohande <apajoohande@gmail.com>)
Ответы Re: what is the best way of storing text+image documents in postgresql  (John R Pierce <pierce@hogranch.com>)
Список pgsql-general
On 06/08/2011 06:13 PM, Arash pajoohande wrote:

> 1. save .doc documents in bytea columns. and show them with a word
> reader in web page (disadvantage: it needs a proper .doc reader
> installed on user computer)

1a: Convert the .doc files to a standard format like PDF that most
browsers can display. That's what I'd do.

> 2. convert document to html format and store html code as string
> (disadvantage: images will remain in file system)

You could always store images as 'bytea' fields on a subtable.

CREATE TABLE doc (
   id serial primary key,
   doc_html text,
   ...
);

CREATE TABLE doc_images (
   id serial primary key,
   doc_id integer references doc(id),
   image_data bytea not null
);

There are advantages and disadvantages to storing files in the database
vs in the file system. It's been discussed to death recently, so see the
mailing list archives.

--
Craig Ringer

В списке pgsql-general по дате отправления:

Предыдущее
От: Gaëtan Allart
Дата:
Сообщение: Abnormal long SELECT query under postgresql 9.0.4
Следующее
От: Tarabas
Дата:
Сообщение: Re: [bulk] Re: Non returning Transactions/Many Locks in Postgres 9.0.4 and 9.0.1