it will sound crazy, but I made one system that stores PNG pictures too! But unfortunately using MySQL and not Postgres, but I've read a little the documentation of Postgres and kinda realised that BLOB (Binary Large OBject) that I was using in MySQL exists also in Postgres, but the problem is in dumping the BLOB data in Postgres for backup purposes. There is just no way to dump it, the only thing to do is to go to the directory where database files are stored and to copy them! So .. its just a suggestion, but you should consider moving to MySQL because of the speed and stability. May be Postgres is Object-Relational Data Base System and have much more possibilities, but MySQL is moving toward it and will not sacrifice the speed .. well, that is what they say anyway.

My friend Evgeny (aka Geniek) told me of a way to store the whole image from disk to a variable in a zip, and then you can insert that variable's content in a table:
open PIC "/dir_to_pic/picture"; undef $/; # by default the new line '\n' my $picture = <PIC>; $/="\n"; # should return it after
like this the whole picture is stored in scalar variable! But if there were new line character in $/ the content of picture would be stored just to the first new line character.

In reply to Re: PostgreSQL and binary data by Alex the Serb
in thread PostgreSQL and binary data by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.