Re: OT: Apache::Session::DBI vs postgresql? --help - Mailing list pgsql-general

From Alex Pilosov
Subject Re: OT: Apache::Session::DBI vs postgresql? --help
Date
Msg-id Pine.BSO.4.10.10106151053520.17529-100000@spider.pilosoft.com
Whole thread Raw
In response to OT: Apache::Session::DBI vs postgresql? --help  (will trillich <will@serensoft.com>)
Responses Re: OT: Apache::Session::DBI vs postgresql? --help  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: OT: Apache::Session::DBI vs postgresql? --help  (will trillich <will@serensoft.com>)
List pgsql-general
Short version:
Apache::Session is a generic class to store a session in some place and
store locking information of session in another place. You can plug in the
classes which detail where the session is stored/locked.

Apache::Session::DBIStore is apparently broken for postgres (due to length
issue). I whined once to maintainer about it, but he was concerned with
backwards compatibility and unwilling to change it. But its outdated
anyway, and you are supposed to use Apache::Session::Store::* classes.

The one you are supposed to use is Apache::Session::Store::Postgres, and
it should work. There's no 8k limit in postgres 7.1 on row length.

-alex

On Fri, 15 Jun 2001, will trillich wrote:


> LONG VERSION:
>
> having burned the manpages into my eyelids, and coming up short,
> i though i'd bug the community at large with this--surely
> someone listening here is using apache with postgres to do some
> handy user-tracking...?
>
>     man Apache::Session::DBI
>
> refers me to
>
>     man Apache::Session::DBIStore
>
> which says
>
>     To use this module, you will need these columns in a table
>     called 'sessions':
>
>         id char(16)
>         length int(11)
>         a_session text
>
> which might be ducky for mysql, but on postgresql (7.0.3 anyhow)
> "length" is illegal as a field name.
>
> i then manage to run across
>
>     man Apache::Session::Store::Postgres
>
> which says
>
>     To use this module, you will need at least these columns
>     in a table called 'sessions':
>
>         id char(32)     # or however long your session IDs are.
>         a_session text  # This has an ~8 KB limit :(
>
> and then
>
>     man Apache::Session::Postgres
>
> tells me to try
>
>     use Apache::Session::Postgres;
>
>     #if you want Apache::Session to open new DB handles:
>
>     tie %hash, 'Apache::Session::Postgres', $id, {
>         DataSource => 'dbi:Pg:dbname=sessions',
>         UserName   => $db_user,
>         Password   => $db_pass,
>         Commit     => 1
>     };
>
> which yields only a
>
>     Can't locate object method "TIEHASH" via package
>     "Apache::Session::Postgres" at doomedtofail.pl line 10.
>
> even though Apache::Session::Postgres "@ISA" Apache::Session,
> which means it should inherit the TIEHASH method there.
>
> --
>
> (((
> if, as an ordinary user, i use "Apache::Session::DBI" i get
>
>     Permission denied at /usr/local/lib/site_perl/Apache/Session/SysVSemaphoreLocker.pm line 63.
>
> before anything gets 'tied'; if i try it as root, i get past the
> permission problem, but then stumble into
>
>     DBD::Pg::st execute failed: ERROR:  Unterminated quoted string
>
> the investigation of which shows it's preparing a select
> statement that's looking for the unfriendly "length" field --
> but i digress.
> )))
>
> SHORT VERSION: (the question)
>
>     ==========================================================
>     i've not figured out how to get Apache::Session::Postgres
>     or Apache::Session::Store::Postgres to do their thing --
>     how does a MOD_PERL script get its hooks into POSTGRES via
>     Apache::Session::DBI ?
>     ==========================================================
>
> i don't really want to revert to the manual approach:
>
>     use Apache::Session::Store::Postgres;
>     my $store = new Apache::Session::Store::Postgres;
>     $store->insert($ref);
>     $store->update($ref);
>     $store->materialize($ref);
>     $store->remove($ref);
>
> i'm sure the "tie %hash,'Apache::Session::DBI',undef" form
> really does work as documented -- so what'd i miss?
>
>


pgsql-general by date:

Previous
From: "Matteo Centenaro"
Date:
Subject: Re: Insert and limit
Next
From: Dariusz Pietrzak
Date:
Subject: Re: CLUSTER. (fwd)