Der Titel bringt es auf den Punkt. Ich verwende PostgreSQL 9.0.0 und eine Datenbank, die PostGIS verwendet.
Im Detail ist die Tabelle, mit der ich Probleme habe, ein Monster. Die Tabellennamen wurden anonymisiert.
Ich aktualisiere die Tabellen, und das erste, was ich tun musste, war das Aufheben der NULL-Einschränkung auf der schedule_id
Säule. Als ich jedoch versuchte, die Anweisung auszuführen, passierte Folgendes:
xxx=# alter table locations_location alter column schedule_id drop not null;
<hangs>
Ja, nada. Ich habe dann versucht, die Kolonne mit dem gleichen Ergebnis abzulegen. Dann habe ich versucht, den Tisch fallen zu lassen, kein Ergebnis. Irgendwelche Ideen?
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