Re: bytea etc. - Mailing list pgsql-sql

From Joe Conway
Subject Re: bytea etc.
Date
Msg-id 3D65040F.7010201@joeconway.com
Whole thread Raw
In response to bytea etc.  (Andrew Klimov <and_k_98@yahoo.com>)
List pgsql-sql
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





pgsql-sql by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: BITMAP INDEXES...
Next
From: imtiaz sm
Date:
Subject: Re: BITMAP INDEXES...