postgres7 install failing to create index

postgres7 install failing to create index

by Harry Burgin -
Number of replies: 5
On a new installation of moodle-latest-14 onto a RH 7.3 box with PHP 4.1.2  and Postgresql 7.3.1 admin/index.php is failing with:

(postgres7): CREATE INDEX mdl_glossary_entries_categories_idx ON mdl_glossary_entries_categories (categoryid)
Warning POstgres Query failed: Error: index named "mdl_glossary_entries_categories" already exists in /var/www/html/moodle/lib/adodb/drivers/adodb-postgres64.inc.php on line 687

and on the next few Create Index commands as well.

Of course, I can't get past that!  Am I missing something, or is there a problem with the postgres inc.php files?
Average of ratings: -
In reply to Harry Burgin

Re: postgres7 install failing to create index

by Penny Leach -
Wow - I will have a look and see what your problem could be, but can you give me some more info:

~ You said this is a new installation - you're not doing an upgrade of an existing moodle are you?

~ I'm guessing that you've typed out the error message rather than copying it because of the capitalisation of POstgres - do you have an exact copy of the error message that you can copy and paste?

~ What are the other create index commands that are failing? Can you paste those too?

~ How did you download moodle? Did you download a fresh copy from the download page? Or did you overwrite an old copy? Also when you say latest 1.4, is that latest stable branch or latest stable release? What does your version.php say?

~ I guess the most important question out of these is the first question really - if you download a new copy of moodle from the download page and try again on a fresh database with no moodle tables anywhere already and it's still broken, that's a serious problem, because I can't reproduce this, I tested 1.4.3 yesterday and it installed cleanly on postgres.

In reply to Penny Leach

Re: postgres7 install failing to create index

by Harry Burgin -
Well, _I_ think its a new install, but I have had a couple of false starts, so maybe moodle thinks otherwise??

Yes, I did type in the error message - I hadn't found the forum discussion about cut & paste problems in Firefox! Got it now, so here is an exact copy:

(postgres7): CREATE INDEX mdl_glossary_entries_categories_category_idx ON mdl_glossary_entries_categories (categoryid)
Warning: PostgreSQL query failed: ERROR: index named "mdl_glossary_entries_categories" already exists in /var/www/html/moodle/lib/adodb/drivers/adodb-postgres64.inc.php on line 687
-1: ERROR: index named "mdl_glossary_entries_categories" already exists

Error
(postgres7): CREATE INDEX mdl_glossary_entries_categories_entryid_idx ON mdl_glossary_entries_categories (entryid)
Warning: PostgreSQL query failed: ERROR: index named "mdl_glossary_entries_categories" already exists in /var/www/html/moodle/lib/adodb/drivers/adodb-postgres64.inc.php on line 687
-1: ERROR: index named "mdl_glossary_entries_categories" already exists

Error

The other CREATE commands that are failing seem to be caused by the install process looping - keeps coming back to CREATE TABLE mdl_glossary - here is the error message:

(postgres7): CREATE TABLE mdl_glossary ( id SERIAL, course int4 NOT NULL default '0', name varchar(255) NOT NULL default '', intro text NOT NULL default '', studentcanpost int2 NOT NULL default '0', allowduplicatedentries int2 NOT NULL default '0', displayformat varchar(50) NOT NULL default 'dictionary', mainglossary int2 NOT NULL default '0', showspecial int2 NOT NULL default '1', showalphabet int2 NOT NULL default '1', showall int2 NOT NULL default '1', allowcomments int2 NOT NULL default '0', usedynalink int2 NOT NULL default '1', defaultapproval int2 NOT NULL default '1', globalglossary int2 NOT NULL default '0', entbypage int NOT NULL default '10', editalways integer NOT NULL default '0', rsstype integer NOT NULL default '0', rssarticles integer NOT NULL default '0', assessed int4 NOT NULL default '0', assesstimestart int4 NOT NULL default '0', assesstimefinish int4 NOT NULL default '0', scale int4 NOT NULL default '0', timecreated int4 NOT NULL default '0', timemodified int4 NOT NULL default '0', PRIMARY KEY (id))
Warning: PostgreSQL query failed: ERROR: Relation 'mdl_glossary_id_seq' already exists in /var/www/html/moodle/lib/adodb/drivers/adodb-postgres64.inc.php on line 687
-5: ERROR: Relation 'mdl_glossary_id_seq' already exists

Error

which repeats ad infinitum.

I downloaded moodle-latest-14.tgz from the download page (at 16.16 GMT on 21 Dec). During the install, moodle tells me it is version 2004083130 (Release 1.4.3).

My php is 4.1.2

I have dropped my moodle database, removed moodle completely from my system, downloaded 1.4.3+ (at 10.05 GMT 23 Dec), created a new database ('moodle'), untarred 1.4.3+ and tried again - exactly the same errors.

BTW, I can't seem to get install.php to accept my database parameters so I have copied config-dist.php to config.php and edited it to suit my setup :-

dbtype = 'postgres7';
dbhost = 'localhost';
dbname = 'moodle';
dbuser = 'moodleuser';
dbpass = 'mypassword';
prefix = 'mdl_';

wwwroot - 'http://10.28.196.199/moodle';
dirroot = '/var/www/html/moodle';
dataroot = '/var/moodledata';

(all preceded by $CFG-> of course)

everything else is 'straight out of the box'

hope all the above helps

TIA

Harry
In reply to Harry Burgin

Re: postgres7 install failing to create index

by Penny Leach -
oooo I think I may know what could be.
See how the CREATE INDEX statement is asking for an index called "mdl_glossary_entries_categories_entryid_idx" but the error says
"mdl_glossary_entries_categories"
Maybe there's a maximum object name length in 7.3.1 that's being exceeded and that's why you're getting duplicate index names...
Moodle follows the naming convention for indexes:
prefix_tablename_columnname_idx
so they can get quite long. I will have a look for you and see if I can find some pg7.3.1 documentation about this. Maybe try making your prefix 1 character or something as a workaround and see if that makes any difference?

In reply to Penny Leach

Re: postgres7 install failing to create index

by Andrew McMillan -
Yes, Penny is right.  The default maximum identifier length was increased from 32 to 64 characters in PostgreSQL 7.4 and later.

The names of the indexes will be irrelevant to the SQL (only the create index statement cares), so they only need to be created, regardless of their names.
In reply to Penny Leach

Re: postgres7 install failing to create index

by Harry Burgin -
Thanks Penny - with the prefix set to 1 character everything installed perfectly. Have a good Christmas and a happy 2005.