Re: OT: Apache::Session::DBI vs postgresql? --help

From: Alex Pilosov <alex(at)pilosoft(dot)com>
To: will trillich <will(at)serensoft(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: OT: Apache::Session::DBI vs postgresql? --help
Date: 2001-06-15 14:59:11
Message-ID: Pine.BSO.4.10.10106151053520.17529-100000@spider.pilosoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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?
>
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dariusz Pietrzak 2001-06-15 14:59:23 CLUSTER.
Previous Message Tom Lane 2001-06-15 14:46:00 Re: Indexing varchar[]'s