On Fri, Mar 31, 2000 at 08:53:28PM +0200, Herbert Liechti wrote:
> Victor Manuel Jaquez Leal wrote:
> >
> > Hi!
> >
> > I want to use the Apache::Session perl module in my WebApps, but when I
> > try to insert the session tuple, the Postgres can't handle the string and
> > abort the operation.
>
> I had the same problem ;-(. I found no solution for that so I went to
> store the session parameters in the file system. I'm also interested
> in a solution.
>
> Below the requirements for the Apache::Session::DbI
>
> NAME
> Apache::Session::DBI - Session persistence via DBI
>
> SCHEMA
> To use this module, you will need these columns in a table
> called 'sessions':
>
> id char(16)
> length int(11)
> a_session text
>
> Where the a_session column needs to be able to handle
> arbitrarily long binary data.
Hmm, you might try the bytea type:
reedstrm=> create table test2 (b bytea, t text);
CREATE
reedstrm=> \d test2
Table = test2
+----------------------------------+----------------------------------+-------+
| Field | Type | Length|
+----------------------------------+----------------------------------+-------+
| b | bytea | var |
| t | text | var |
+----------------------------------+----------------------------------+-------+
reedstrm=> insert into test2 values ('abdkrxf\02\v\00fges','abdkrxf\02\v\00fges');
INSERT 937909 1
reedstrm=> select * from test2
reedstrm-> ;
b |t
------------+---------
abdkrxf\002v|abdkrxfav
(1 row)
reedstrm=>
it won't take a byte with value \00, but otherwise might work. Interestingly
enough, the cut and paste into this email deleted the funny 50% gray box
that appeared after the 'xf' in the 't' column.
Ross
--
Ross J. Reedstrom, Ph.D., <reedstrm@rice.edu>
NSBRI Research Scientist/Programmer
Computer and Information Technology Institute
Rice University, 6100 S. Main St., Houston, TX 77005