Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

The title pretty much sums it up. I'm running PostgreSQL 9.0.0 and am running a database that's using PostGIS.

In more detail, the table that I'm having issues with is a monster. The table names have been anonymized.

I'm updating the tables, and the first thing I needed to do was drop the null constraint on the schedule_id column. However, when I attempted to execute the statement, the following happened:

xxx=# alter table locations_location alter column schedule_id drop not null;
<hangs>

Yep, nada. I then tried to drop the column with the same result. Then I tried to drop the table, no result. Any ideas?

                                       Table "public.alpha_alpha"
       Column        |          Type          |                            Modifiers                            
---------------------+------------------------+-----------------------------------------------------------------
 id                  | integer                | not null default nextval('alpha_alpha_id_seq'::regclass)
 status              | integer                | not null
 address_line_one    | character varying(100) | not null
 address_line_two    | character varying(100) | not null
 city                | character varying(100) | not null
 city_slug           | character varying(50)  | not null
 state_id            | integer                | not null
 postal_code         | character varying(15)  | not null
 address_tip         | character varying(255) | not null
 phone               | character varying(30)  | not null
 fax                 | character varying(30)  | not null
 name                | character varying(75)  | not null
 dma_id              | integer                | 
 store_number        | character varying(5)   | not null
 store_type_id       | integer                | not null
 store_email_address | character varying(75)  | not null
 store_website       | character varying(200) | not null
 date_opened         | date                   | 
 new                 | boolean                | not null
 slug                | character varying(50)  | not null
 online_ordering_url | character varying(200) | not null
 delivery_url        | character varying(200) | not null
 has_catering        | boolean                | not null
 now_hiring          | boolean                | not null
 schedule_id         | integer                | not null
 tier                | integer                | not null
 coordinates         | geometry               | 
 schedule_display    | character varying(200) | not null default ''::character varying
 sunday_open         | time without time zone | 
 sunday_close        | time without time zone | 
 monday_close        | time without time zone | 
 tuesday_open        | time without time zone | 
 tuesday_close       | time without time zone | 
 wednesday_open      | time without time zone | 
 wednesday_close     | time without time zone | 
 thursday_open       | time without time zone | 
 thursday_close      | time without time zone | 
 friday_open         | time without time zone | 
 friday_close        | time without time zone | 
 saturday_open       | time without time zone | 
 saturday_close      | time without time zone | 
Indexes:
    "alpha_alpha_pkey" PRIMARY KEY, btree (id)
    "alpha_alpha_name_key" UNIQUE, btree (name)
    "alpha_alpha_name_state_id_key" UNIQUE, btree (name, state_id)
    "alpha_alpha_store_number_key" UNIQUE, btree (store_number)
    "alpha_alpha_city_slug" btree (city_slug)
    "alpha_alpha_city_slug_like" btree (city_slug varchar_pattern_ops)
    "alpha_alpha_coordinates_id" gist (coordinates)
    "alpha_alpha_dma_id" btree (dma_id)
    "alpha_alpha_schedule_id" btree (schedule_id)
    "alpha_alpha_slug" btree (slug)
    "alpha_alpha_slug_like" btree (slug varchar_pattern_ops)
    "alpha_alpha_state_id" btree (state_id)
    "alpha_alpha_store_type_id" btree (store_type_id)
Check constraints:
    "enforce_dims_coordinates" CHECK (st_ndims(coordinates) = 2)
    "enforce_geotype_coordinates" CHECK (geometrytype(coordinates) = 'POINT'::text OR coordinates IS NULL)
    "enforce_srid_coordinates" CHECK (st_srid(coordinates) = 4329)
Foreign-key constraints:
    "alpha_alpha_dma_id_fkey" FOREIGN KEY (dma_id) REFERENCES alpha_dma(id) DEFERRABLE INITIALLY DEFERRED
    "alpha_alpha_schedule_id_fkey" FOREIGN KEY (schedule_id) REFERENCES alpha_schedule(id) DEFERRABLE INITIALLY DEFERRED
    "alpha_alpha_state_id_fkey" FOREIGN KEY (state_id) REFERENCES countries_region(id) DEFERRABLE INITIALLY DEFERRED
    "alpha_alpha_store_type_id_fkey" FOREIGN KEY (store_type_id) REFERENCES alpha_storetype(id) DEFERRABLE INITIALLY DEFERRED
Referenced by:
    TABLE "beta_epsilon" CONSTRAINT "beta_epsilon_xxx_alpha_id_fkey" FOREIGN KEY (xxx_alpha_id) REFERENCES alpha_alpha(id) DEFERRABLE INITIALLY DEFERRED
    TABLE "beta_delta" CONSTRAINT "beta_delta_xxx_alpha_id_fkey" FOREIGN KEY (xxx_alpha_id) REFERENCES alpha_alpha(id) DEFERRABLE INITIALLY DEFERRED
    TABLE "beta_lambda" CONSTRAINT "beta_lambda_xxx_alpha_id_fkey" FOREIGN KEY (xxx_alpha_id) REFERENCES alpha_alpha(id) DEFERRABLE INITIALLY DEFERRED
    TABLE "beta_lambda" CONSTRAINT "beta_lambda_event_alpha_id_fkey" FOREIGN KEY (event_alpha_id) REFERENCES alpha_alpha(id) DEFERRABLE INITIALLY DEFERRED
    TABLE "gamma_applicant_alpha" CONSTRAINT "gamma_applicant_alpha_alpha_id_fkey" FOREIGN KEY (alpha_id) REFERENCES alpha_alpha(id) DEFERRABLE INITIALLY DEFERRED
    TABLE "alpha_alpha_services" CONSTRAINT "alpha_id_refs_id_e7506f2d" FOREIGN KEY (alpha_id) REFERENCES alpha_alpha(id) DEFERRABLE INITIALLY DEFERRED
    TABLE "news_upsilon_alpha" CONSTRAINT "news_upsilon_alpha_alpha_id_fkey" FOREIGN KEY (alpha_id) REFERENCES alpha_alpha(id) DEFERRABLE INITIALLY DEFERRED
share|improve this question
    
Seems like the table is locked, is there any process accessing this table ? –  Sathya Oct 25 '10 at 20:16
    
No idea, how would I find that out? –  Dan Oct 26 '10 at 0:31
    
connect using pgAdmin III and goto Tools->Server Status it will show you all active locks. –  chotchki May 23 '11 at 19:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.