Re: bytea

From: Dennis Gearon <gearond(at)fireserve(dot)net>
To:
Cc: pgsql General List <pgsql-general(at)postgresql(dot)org>
Subject: Re: bytea
Date: 2004-05-11 18:50:06
Message-ID: 40A1205E.8060407@fireserve.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks for all the answers everybody, but I need to know also an answer
to the other question:

Does the bytea make its own files automatically for large objects?

Also, how about backups with tables having bytea columns.?

Jonathan Bartlett wrote:

>>Also, if I wanted to put a *.pdf file in a bytea column, what functions
>>do I use to escape any characters in it?
>>
>>
>
>What programming language are you using?
>
>In Perl, you do something like:
>
>$sth->bind_param(1, $file_data, DBI::SQL_BINARY); #DBI::SQL_BINARY is
>deprecated, but it works
>
>In php you do:
>
>$file_data = pg_escape_bytea($file_data);
>
>$db->query("insert into blah(blahh) values ('${file_data}'::bytea);
>
>To retrieve the info in Perl, it's just a regular fetchrow()
>
>my ($file_data) = $sth->fetchrow();
>
>In php, you have to run stripcslashes() on the data.
>
>list($file_data) = $query->fetchrow();
>$file_data = stripcslashes($file_data);
>
>Jon
>
>
>
>
>>---------------------------(end of broadcast)---------------------------
>>TIP 4: Don't 'kill -9' the postmaster
>>
>>
>>
>
>
>

In response to

  • Re: bytea at 2004-05-11 16:30:15 from Jonathan Bartlett

Responses

  • Re: bytea at 2004-05-11 20:04:01 from scott.marlowe
  • Re: bytea at 2004-05-11 20:49:12 from Alvaro Herrera
  • Re: bytea at 2004-05-11 21:06:51 from Jonathan Bartlett

Browse pgsql-general by date

  From Date Subject
Next Message Mike Nolan 2004-05-11 19:33:49 Re: security question
Previous Message Bruno Wolff III 2004-05-11 18:32:40 Re: security question