Unable to install module for postgresql database
azriprajwala - April 7, 2009 - 13:50
| Project: | Drupal for Facebook |
| Version: | 6.x-2.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | closed |
Description
I am using postgresql 8.2.7 version.
When I enable these modules I am getting these errors. It looks like install files are not supporting postgres.
* warning: pg_query() [function.pg-query]: Query failed: ERROR: syntax error at or near "(" LINE 2: nid int_unsigned(11) NOT NULL, ^ in /var/www/drupal-6.9/includes/database.pgsql.inc on line 139.
* user warning: query: CREATE TABLE fb_app ( nid int_unsigned(11) NOT NULL, label varchar(128) NOT NULL, apikey varchar(128) NOT NULL, id varchar(128) NOT NULL, secret varchar(128) NOT NULL, data text, PRIMARY KEY (nid), CONSTRAINT fb_app_apikey_key UNIQUE (apikey) ) in /var/www/drupal-6.9/includes/database.inc on line 515.
* warning: pg_query() [function.pg-query]: Query failed: ERROR: syntax error at or near "(" LINE 2: nid int_unsigned(11) NOT NULL, ^ in /var/www/drupal-6.9/includes/database.pgsql.inc on line 139.
* user warning: query: CREATE TABLE fb_app_block ( nid int_unsigned(11) NOT NULL, delta varchar(32) NOT NULL, format int(11) default 0, body text NOT NULL, PRIMARY KEY (nid, delta) ) in /var/www/drupal-6.9/includes/database.inc on line 515.
* warning: pg_query() [function.pg-query]: Query failed: ERROR: syntax error at or near "(" LINE 3: fbu int_unsigned(11) NOT NULL, ^ in /var/www/drupal-6.9/includes/database.pgsql.inc on line 139.
* user warning: query: CREATE TABLE fb_user_app ( apikey varchar(128) NOT NULL, fbu int_unsigned(11) NOT NULL, uid int NOT NULL, added int_unsigned(4) NOT NULL, time_cron int_unsigned(11) NOT NULL, time_access int_unsigned(11) NOT NULL, session_key varchar(128) NOT NULL, session_key_expires int_unsigned(11) NOT NULL, PRIMARY KEY (apikey, fbu) ) in /var/www/drupal-6.9/includes/database.inc on line 515.
* Drupal for Facebook has been enabled, but not properly installed. Please read the README.txt.Thanks,
Prajwala

#1
Both fb_app.install and fb_user.install use Drupal's schema data structure. I can't tell you why its not working with postgres. If you or anyone else with postgres installed can provide a patch that fixes the problem, I'll be happy to check it in.
#2
The issue here is that postgres doesn't support unsigned integers, but drupal has a work around.
However in the schema structure you can't set the field as unsigned and also set a length.
I'm working on a patch and will have it soon - just need to work out which types I should actually be using :)
#3
Thank you I appreciate help with this. Let me know any mistakes you find so I can avoid them in the future.
#4
I've just made up a patch which let the modules install with postgresql - this is done for every module that required it not just fb_app and fb_user.
I've changed the way that the sessions table is modified for long session ids too, as this failed silently before.
I'd prefer that it wasn't modified by default but that should probably be a seperate ticket.
Let me know if there are any issue with the patch
#5
#6
I can confirm this works on my Postgres install. Maybe the patch to add schema API to fb_feed should be separate though?
Also FYI there's an outstanding issue to fix (invalid) use of length with integers in core: #346450: Schema API: 'length' should be ignored on non varchar and char fields
#7
awesome you guys rock!
#8
Automatically closed -- issue fixed for 2 weeks with no activity.