I've just started to play with Drupal with PostgreSQL. I'm using the
most recent version of Drupal from CVS (as recommended elsewhere
in the support forum). I'm running PostgreSQL 7.1.3, Apache 1.3.24,
and mod_php-4.2.2. All this is running under FreeBSD 4.5-RELEASE.

When I try to create my first user, this is the error I get back:

warning: First argument to array_keys() should be an array in /var/www/data/drupal/modules/user.module on line 280.warning: Wrong datatype for second argument in call to in_array in /var/www/data/drupal/modules/user.module on line 127.warning: First argument to array_keys() should be an array in /var/www/data/drupal/modules/user.module on line 280.warning: Wrong datatype for second argument in call to in_array in /var/www/data/drupal/modules/user.module on line 127.warning: First argument to array_keys() should be an array in /var/www/data/drupal/modules/user.module on line 280.warning: Wrong datatype for second argument in call to in_array in /var/www/data/drupal/modules/user.module on line 127.warning: First argument to array_keys() should be an array in /var/www/data/drupal/modules/user.module on line 280.warning: Wrong datatype for second argument in call to in_array in /var/www/data/drupal/modules/user.module on line 127.warning: First argument to array_keys() should be an array in /var/www/data/drupal/modules/user.module on line 280.warning: Wrong datatype for second argument in call to in_array in /var/www/data/drupal/modules/user.module on line 127.warning: First argument to array_keys() should be an array in /var/www/data/drupal/modules/user.module on line 280.warning: Wrong datatype for second argument in call to in_array in /var/www/data/drupal/modules/user.module on line 127.

This does not happen for any user but the first. I can register second
and third users, etc.

Here's the result of SELECT * FROM USERS; on my Drupal database
(sorry for the formatting):

uid | name | pass | mail | homepage | mode | sort | threshold | theme | signature | timestamp | hostname | status | timezone | rating | language | sid | init | session |
data | rid
-----+------+----------------------------------+------+----------+------+------+-----------+-------+-----------+-----------+----------+--------+----------+--------+----------+-----+------+---------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----
1 | | 6230bf26c4eb0052d3e9ae727197d38c | | | 0 | 0 | 0 | | | 0 | | 0 | | | | | | | a:6:{s:4:"name";s:7:"somenewuser";s:4:"init";s:20:"somenewuser@domain.com";s:4:"mail";s:20:"somenewuser@domain.com";s:3:"rid";N;s:6:"status";i:1;s:9:"timestamp";i:1030674426;} | 0
(1 row)

Any help would be greatly appreciated.

Comments

mikhael’s picture

This is my question. I probably should have registered before asking. :-/

mehrdad-1’s picture

Actually this problem is not PostgreSQL related, because I get into the same problem with both PostgreSQL and MySQL.

In my case what happens is that the first user cannot even login! So, it's like I first create the first user, and I get the Warnings just like mikhael has pointed out. But then later when I try to login with the userid and the generated password, it gives me an error message saying something like wrong user and/or password.

I never tried creating a second user. I just gave up and went back to the last release :-/

Anonymous’s picture

I seem to be having the same problem with a CVS done at 07.09.2002, the same error message is displayed, and in addition, the first user (who's password is usually displayed) is not even attempted to be displayed and mailed as well (bad, especially for setups where SMTP is broken!)

Is there any solution/fix for the CVS user.module? Would manually creating a line in the database for the first user work?

It seems that the problem is with trying to get keys and arrays which don't exist yet (as there are no enteries in the 'user' table of the database) in user.module with no check as of weither anything is there allready or not... ?

mikhael’s picture

I tried lots of things to 'fix' that first entry. I tried creating a second user, then duping its username and password to the first entry, which didn't seem to work. If I had been more awake at the time I was bashing on it, I'd likely have kept a log so I could provide more useful information.

I think I'm on the verge of giving up on Drupal, though. If I can't make it work with PostgreSQL, I've wasted my time. Only local images are allowed. There just doesn't seem to be much support for PostgreSQL in the content management and blogging communities.

--Mik

Anonymous’s picture

I don't think this is a PostgreSQL specific problem, as it happens with MySQL as well (3.23.51), it's probably just some changes in the CVS version of either the database structure or the user.module... some comments/fixes/suggestions from the author of user.module would be greatly appriciated...

Drupal 4.0.0 release seems to work in both with PostgreSQL and MySQL quite fine, which version are you trying?

Anonymous’s picture

I disagree. Drupal 4.0.0 does NOT work with PostgreSQL quite fine. In fact, as I type this, I'm watching my db box crush itself. Swap is showing 68MB usage and climbing. normally this is zero. Top shows httpd and postgres taking up 45% and 40% of the processor respectively. I predict that as soon as swap runs out something is going to crash hard.

When using the lastest version from CVS (latest as of when I downloaded it), I get the errors described in the first post of this thread.

Perhaps its not a Postgres related problem. I don't think I can spend much more time fighting with this, though.

Anonymous’s picture

Warning: This is *very very* ugly, but works =)

Install Drupal CVS, download Drupal release 4.0.0, set up database structure as of CVS, replace /modules/user.module in working CVS install with the one from 4.0.0 release, create first user, replace /module/user.module with the CVS one again...

From that point on, all works...

What this gives us is: the problem is indeed in the user.module code in the CVS, I did'nt have a chance to take a look at the code yet, but for some reason, the CVS user.module is actually *smaller* than the release one... some diff/grep looking through is probably a good idea, but I'll leave that to those qualified.