For problems and solutions related to database compatibility.

Need unique key in profile_values table

I hope this is the right place to describe an issue we are having with the database scheme and the fix we have made for it. Could Drupal developers please comment?

In brief we should not allow multiple rows in profile_values which have the same (fid, uid), as this represents multiple values for a given profile field, which we believe to be wrong.

Background
We are using Drupal in an environment where we have approximately 2,500 users whose usernames, passwords, e-mail addresses etc are imported periodically from another system. As part of this we have some profile fields which describe the person (profile_fullname is one) and we have found a problem with the database definitions.

Details
Specifically, profile_values is defined as:

CREATE TABLE profile_values (
  fid int(10) unsigned default '0',
  uid int(10) unsigned default '0',
  value text,
  KEY uid (uid),
  KEY fid (fid)
)
DEFAULT CHARACTER SET utf8;

We believe that we should change the last KEY into

  unique key fiduid (fid, uid)

We have done this post-hoc my adding an index

create unique index fiduid on profile_values(fid, uid);

Why was this a problem?
The reason we needed to make this change is because our user list is updated periodically by another script producing an SQL script which writes thousands of rows into profile_values table as follows:

innodb database

I didn't know weather this is considered support or development, so I hope I didn't post it in the wrong location.

I've converted all tables in the drupal installation to innodb, reason is that I aggregate an average 50 articles every 10 minutes, an estimated 200 insert queries or so on most drupal tables. The inserts would lock out the select statements and the site would go down. After converting it to innodb, the problem was pretty much solved, but there are some lock statements that I don't know how to handle.

PostgreSQL case-sensitivity

Hi,
unlike MySQL, PostgreSQL has case-sensitive equality comparison ('SELECT ... WHERE X = Y') and the 'LIKE' statement is case-sensitive, too. Does Drupal take this into account? I don't yet have a PostgreSQL system, so I haven't tested it.

Especially, is Drupal's users module case-insensitive, so nobody can have your username (e.g.: wkornewald and Wkornewald and WKornewald)?

Bye,
Waldemar Kornewald

Converting to MySQL...

I currently use Drupal with PostgreSQL. While I usually prefer PostgreSQL, the fact that so many more people are familiar with MySQL and the fact that there seems to be better support for it in the Drupal community makes me want to change. Is there any way within Drupal that I can take my existing sites, back them up, then restore them into a MySQL databases? I would rather avoid doing this at the database level if at all possible.

Thanks,

How Do I Integrate form to export to Microsoft Access File?

I am trying to create a form that will export fields into a Microsoft Access file or at least a .CVS file. Anyone know how I should do this?

%d modifier in db_query not wanted

Hi,

This is my first post here.

Im developing a site using drupal (very good btw) but ive run into a snag when using db_query:
if i run a query like:
db_query('SELECT DATE_FORMAT('2006-01-01', '%d-%m-%Y');');
I expect to get "01-01-2006" instead of that i get "0-01-2006". (notice the missing '1' in de day)

Pages

Subscribe with RSS Subscribe to RSS - Deprecated - Database compatibility