Hi guys,

I had an error when updating the database about the files timestamp index creation failing. So I checked the code really quick and I found this:

1) You call the same function twice with the exact same parameters

2) You use the MySQL incompatible command: "SHOW INDEX FROM ...", which means PostgreSQL people will get an error, although minor (i.e. it just says it cannot create the index and moves on.)

  _boost_index_exists($ret, 'node_revisions', 'timestamp');
  _boost_index_exists($ret, 'files', 'timestamp');
  _boost_index_exists($ret, 'comments', 'timestamp');
  _boost_index_exists($ret, 'node', 'changed');
  _boost_index_exists($ret, 'files', 'timestamp');
  _boost_index_exists($ret, 'node_comment_statistics', 'last_comment_timestamp');
  _boost_index_exists($ret, 'votingapi_vote', 'timestamp');

Thank you.
Alexis Wilke

CommentFileSizeAuthor
#7 boost-637002.patch1.51 KBmikeytown2
#3 boost-637002.patch1.28 KBmikeytown2
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mikeytown2’s picture

Can I get the output of this sql command from you?

SELECT * FROM pg_indexes WHERE tablename = 'node_revisions';
AlexisWilke’s picture

You will get this:

drupal=# SELECT * FROM pg_indexes WHERE tablename = 'node_revisions';
 schemaname |   tablename    |          indexname           | tablespace |                                       indexdef                                        
------------+----------------+------------------------------+------------+---------------------------------------------------------------------------------------
 public     | node_revisions | node_revisions_timestamp_idx |            | CREATE INDEX node_revisions_timestamp_idx ON node_revisions USING btree ("timestamp")
 public     | node_revisions | node_revisions_uid_idx       |            | CREATE INDEX node_revisions_uid_idx ON node_revisions USING btree (uid)
 public     | node_revisions | node_revisions_nid_idx       |            | CREATE INDEX node_revisions_nid_idx ON node_revisions USING btree (nid)
 public     | node_revisions | node_revisions_pkey          |            | CREATE UNIQUE INDEX node_revisions_pkey ON node_revisions USING btree (vid)

So if you get indexname I guess you'd get what you need. 8-)

Thank you.
Alexis

mikeytown2’s picture

Status: Active » Needs review
FileSize
1.28 KB

This was useful
http://api.drupal.org/api/global/db_type/6

let me know if this patch works for you

AlexisWilke’s picture

I will test later, but a quick look, I think that the name will be psql (as the extension to the file) and not postgresql. My idea... 8-}

More soon.
Alexis Wilke

mikeytown2’s picture

Assigned: AlexisWilke » Unassigned
Status: Needs review » Fixed
AlexisWilke’s picture

Excellent. 8-)

mikeytown2’s picture

Category: bug » task
Status: Fixed » Needs review
FileSize
1.51 KB

forgot to remove the extra call to the files table; doesn't do much since that index won't be created unless the index doesn't exist.

AlexisWilke’s picture

Perfection looks good 8-)

Good patch.

Thank you.
Alexis

mikeytown2’s picture

Status: Needs review » Fixed

committed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.