pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedStoring image contents in TEXT fields
5+ messages / 3 participants
[nested] [flat]
* Storing image contents in TEXT fields
@ 2001-06-26 22:11 Jerome Alet <alet@unice.fr>
2001-06-26 22:34 ` Re: Storing image contents in TEXT fields Alex Pilosov <alex@pilosoft.com>
2001-06-27 15:17 ` Re: Storing image contents in TEXT fields Jan Wieck <JanWieck@Yahoo.com>
0 siblings, 2 replies; 5+ messages in thread
From: Jerome Alet @ 2001-06-26 22:11 UTC (permalink / raw)
To: pgsql-sql
Hi,
I wanted to know if it's possible to store an image content in a TEXT field,
or if another type is needed (in this case, then which one ?).
I don't want to use BLOBs, because I modify an existing application
which also works with MySQL, and I can't update to postgresql-7.1.x
(I don't admin this server)
in a TEXT field the image seems to be truncated at the first nul byte.
Thanks in advance for any help.
bye,
Jerome Alet
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Storing image contents in TEXT fields
2001-06-26 22:11 Storing image contents in TEXT fields Jerome Alet <alet@unice.fr>
@ 2001-06-26 22:34 ` Alex Pilosov <alex@pilosoft.com>
1 sibling, 0 replies; 5+ messages in thread
From: Alex Pilosov @ 2001-06-26 22:34 UTC (permalink / raw)
To: Jerome Alet <alet@unice.fr>; +Cc: pgsql-sql
You must use type 'bytea'.
When you insert data, you must escape them like this: '\001\002\\000'
note the double-backslash for null byte.
On Wed, 27 Jun 2001, Jerome Alet wrote:
> Hi,
>
> I wanted to know if it's possible to store an image content in a TEXT field,
> or if another type is needed (in this case, then which one ?).
>
> I don't want to use BLOBs, because I modify an existing application
> which also works with MySQL, and I can't update to postgresql-7.1.x
> (I don't admin this server)
>
> in a TEXT field the image seems to be truncated at the first nul byte.
>
> Thanks in advance for any help.
>
> bye,
>
> Jerome Alet
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>
>
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Storing image contents in TEXT fields
2001-06-26 22:11 Storing image contents in TEXT fields Jerome Alet <alet@unice.fr>
@ 2001-06-27 15:17 ` Jan Wieck <JanWieck@Yahoo.com>
2001-06-27 17:48 ` Re: Storing image contents in TEXT fields Jerome Alet <alet@unice.fr>
1 sibling, 1 reply; 5+ messages in thread
From: Jan Wieck @ 2001-06-27 15:17 UTC (permalink / raw)
To: Jerome Alet <alet@unice.fr>; +Cc: pgsql-sql
Jerome Alet wrote:
> Hi,
>
> I wanted to know if it's possible to store an image content in a TEXT field,
> or if another type is needed (in this case, then which one ?).
>
> I don't want to use BLOBs, because I modify an existing application
> which also works with MySQL, and I can't update to postgresql-7.1.x
> (I don't admin this server)
>
> in a TEXT field the image seems to be truncated at the first nul byte.
To have the highest portability across ALL databases, you
might be best off by converting it to/from base64 or similar
in the client application and store the string in a text or
varchar attribute.
If you can't upgrade to 7.1.x, you'll have to slice and
reassemble it yourself. 7.0 doesn't have TOAST.
Jan
--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck@Yahoo.com #
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Storing image contents in TEXT fields
2001-06-26 22:11 Storing image contents in TEXT fields Jerome Alet <alet@unice.fr>
2001-06-27 15:17 ` Re: Storing image contents in TEXT fields Jan Wieck <JanWieck@Yahoo.com>
@ 2001-06-27 17:48 ` Jerome Alet <alet@unice.fr>
2001-06-27 19:10 ` Re: Storing image contents in TEXT fields Jan Wieck <JanWieck@Yahoo.com>
0 siblings, 1 reply; 5+ messages in thread
From: Jerome Alet @ 2001-06-27 17:48 UTC (permalink / raw)
To: Jan Wieck <JanWieck@yahoo.com>; +Cc: pgsql-sql
On Wed, Jun 27, 2001 at 11:17:28AM -0400, Jan Wieck wrote:
> Jerome Alet wrote:
> > Hi,
> >
> > I wanted to know if it's possible to store an image content in a TEXT field,
> > or if another type is needed (in this case, then which one ?).
> >
> > I don't want to use BLOBs, because I modify an existing application
> > which also works with MySQL, and I can't update to postgresql-7.1.x
> > (I don't admin this server)
> >
> > in a TEXT field the image seems to be truncated at the first nul byte.
>
> To have the highest portability across ALL databases, you
> might be best off by converting it to/from base64 or similar
> in the client application and store the string in a text or
> varchar attribute.
I think that I'll modify the app anyway, since I fear to hit the
tuple max size with some postgresql versions. I think it's better
to store images outside the database, but the original app developper
didn't seem to think the same ;-)
bye, and thanks to all
Jerome Alet
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Storing image contents in TEXT fields
2001-06-26 22:11 Storing image contents in TEXT fields Jerome Alet <alet@unice.fr>
2001-06-27 15:17 ` Re: Storing image contents in TEXT fields Jan Wieck <JanWieck@Yahoo.com>
2001-06-27 17:48 ` Re: Storing image contents in TEXT fields Jerome Alet <alet@unice.fr>
@ 2001-06-27 19:10 ` Jan Wieck <JanWieck@Yahoo.com>
0 siblings, 0 replies; 5+ messages in thread
From: Jan Wieck @ 2001-06-27 19:10 UTC (permalink / raw)
To: Jerome Alet <alet@unice.fr>; +Cc: Jan Wieck <JanWieck@Yahoo.com>; pgsql-sql
Jerome Alet wrote:
> On Wed, Jun 27, 2001 at 11:17:28AM -0400, Jan Wieck wrote:
> > Jerome Alet wrote:
> > > Hi,
> > >
> > > I wanted to know if it's possible to store an image content in a TEXT field,
> > > or if another type is needed (in this case, then which one ?).
> > >
> > > I don't want to use BLOBs, because I modify an existing application
> > > which also works with MySQL, and I can't update to postgresql-7.1.x
> > > (I don't admin this server)
> > >
> > > in a TEXT field the image seems to be truncated at the first nul byte.
> >
> > To have the highest portability across ALL databases, you
> > might be best off by converting it to/from base64 or similar
> > in the client application and store the string in a text or
> > varchar attribute.
>
> I think that I'll modify the app anyway, since I fear to hit the
> tuple max size with some postgresql versions. I think it's better
> to store images outside the database, but the original app developper
> didn't seem to think the same ;-)
There is no "tuple max size" any more since PostgreSQL
version 7.1. If you get it through the parser, planner, and
executor (depends on virtual memory), it'll make it down to
the disk. So if you don't intend to store tenth-mega-sized
multi-frame video clips, you should be fine.
Jan
--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck@Yahoo.com #
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2001-06-27 19:10 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-06-26 22:11 Storing image contents in TEXT fields Jerome Alet <alet@unice.fr>
2001-06-26 22:34 ` Alex Pilosov <alex@pilosoft.com>
2001-06-27 15:17 ` Jan Wieck <JanWieck@Yahoo.com>
2001-06-27 17:48 ` Jerome Alet <alet@unice.fr>
2001-06-27 19:10 ` Jan Wieck <JanWieck@Yahoo.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox