[kronolith] Fwd: [dev] Re: [cvs] commit: kronolith/docs CHANGES kronolithday.php menu.phpmonth.php prefs.php week.php workweek.php kronolith/graphics private.gif public.gif

Marc G. Fournier scrappy@hub.org
Thu, 5 Sep 2002 00:48:25 -0300 (ADT)


On Wed, 4 Sep 2002, Chuck Hagenbuch wrote:

> Quoting "Marc G. Fournier" <scrappy@hub.org>:
>
> > Okay, this is where I may be mis-understanding you ... all connections to
> > the database are as user pgsql (the superuser), so there shouldn't be any
> > issues about the ability to create tables:
>
> Hrm. I haven't used postgres, myself, but I'd suggest tracing the PEAR code
> (DB_pgsql) inside the nextId() function, to see what it's doing and what's
> going wrong.

Yowch ... that is painful ... me brain hurts ;(

Okay, for starters, it looks like pear (both the standalone
pear-devel-4.1.0 and the one in php 4.2.2) are still using deprecated
pgsql/php functions:

        $result = @pg_exec($this->connection, $query);
        if (!$result) {
            return $this->pgsqlRaiseError();
        }


"Note:  This function used to be called pg_exec(). pg_exec() is still
available for compatibility reasons but users are encouraged to use the
newer name.
"

So, when it 'fails', its not grabbing the reason for failure properly and
just returning a DB_ERROR (-1) instead of what nextId is expecting:

                $result->getCode() == DB_ERROR_NOSUCHTABLE) {

which is -18 ...

Manually creating the sequence corrects the problem ... I suggest this
change to category.sql (or make a pgsql_category.sql?) to get around the
problem:

*** category.sql.orig   Thu Sep  5 03:47:03 2002
--- category.sql        Thu Sep  5 03:47:22 2002
***************
*** 21,24 ****
--- 21,26 ----
  CREATE INDEX category_user_idx ON horde_categories (user_uid);
  CREATE INDEX category_serialized_idx ON horde_categories (category_serialized);

+ CREATE SEQUENCE horde_categories_seq;
+
  GRANT SELECT, INSERT, UPDATE, DELETE ON horde_categories TO horde;

with this, my 'new event' pops up again and life goes back to normal :)