Обсуждение: bytea etc.

Поиск
Список
Период
Сортировка

bytea etc.

От
Andrew Klimov
Дата:
Hi , All!
 
Could someone clarify me  :
 
When I want to store BLOB's internally in database (for example jpeg )
should I use bytea or OID? Is OID something like BFILE in Oracle 8i?
 
If both are appropriate for internal BLOB why I can't use
 
update image set picture=lo_import('Myfile') where image_code='blablabla' ;
 
with bytea column type but only with OID column type?
 
 
And one more thing:
Where is function byteain documented?
 
TIA,
Andrew.



Do You Yahoo!?
HotJobs, a Yahoo! service - Search Thousands of New Jobs

Re: bytea etc.

От
Joe Conway
Дата:
Andrew Klimov wrote:
> When I want to store BLOB's internally in database (for example jpeg )
> should I use bytea or OID? Is OID something like BFILE in Oracle 8i?

Bytea is a "normal" data type, stored in-line similar to text (it can 
actually be stored in an external toast table, but that's transparent to 
the user), whereas the large object interface has its own special access 
functions and maintains file-oriented access. See:  http://www.postgresql.org/idocs/index.php?largeobjects.html
for more info on large objects.

> If both are appropriate for internal BLOB why I can't use
>  
> update image set picture=lo_import('Myfile') where image_code='blablabla' ;
> with bytea column type but only with OID column type?

See above. The two are different.

> And one more thing:
> Where is function byteain documented?

It's not, because you should never use it directly. You really need to 
spend some time reading the documentation. See:  http://www.postgresql.org/idocs/index.php?datatype-binary.html
for more info on bytea, and:  http://www.postgresql.org/idocs/index.php?functions-binarystring.html
for info on bytea specific functions.

Joe