Forum OpenACS Q&A: Response to Warning: I'm about to hack OpenACS for Multiple Domains

Because AOLserver3.0 has a broken ns_getcsv function, I have to run a copy of 2.3.3, which has built in table browsing under /NS/Db/. There is no index browsing, but you do get system tables listed. After using Don's ls method above, I tried the following with success:

  1. Create a table with a unique index:
    create table my_table ( user_id integer not null primary key, email varchar(100) not null, unique(email))
  2. List indexes on table of interest (my_table):
    select * from pg_indexes where tablename = 'my_table'

    This gave me indexes named my_table_pkey and my_table_email_key.

  3. Insert some data.
  4. Alter table: alter table my_table add domain varchar(100) not null
  5. Insert some domain data: update my_table set domain = 'mydomain.com'
  6. Drop unique index on email: drop index my_table_email_key
  7. Create new unique index: create unique index my_table_email_domain_key on my_table(email,domain)