2016-03-22 10 views
1

私はそれにこのFOREIGN KEY制約を持つaccountsテーブルがあります。なぜこのFOREIGN KEY制約をアカウントテーブルにドロップできないのですか?

TABLE "edits" CONSTRAINT "edits_account_id_fkey1" FOREIGN KEY (account_id) REFERENCES accounts(id) ON DELETE CASCADE 

を、私はこの制約を削除したいが、毎回、私は以下のコマンドを実行してみてください:

ALTER TABLE accounts DROP CONSTRAINT edits_account_id_fkey1; 

私はこのエラーを取得します:

ERROR: constraint "edits_account_id_fkey1" of relation "accounts" does not exist 

明らかに存在します。私は\d accountsコマンドでそれを見ています。なぜこうなった?

------------- ----------- EDIT

accounts

+0

その出力には、 'edits_account_id_fkey1'という名前の制約はありません。 –

答えて

2
Indexes: 
     ........ 
    Check constraint: 
     ...... 

    Foreign-key constraints: 
     "accounts_about_markup_id_fkey" FOREIGN KEY (about_markup_id) REFERENCES markups(id) ON DELETE CASCADE 
     "accounts_best_vita_id_fkey" FOREIGN KEY (best_vita_id) REFERENCES vitae(id) 
     "accounts_organization_id_fkey" FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE 

    Referenced by: 
     TABLE "account_reports" CONSTRAINT "account_reports_account_id_fkey" FOREIGN KEY (account_id) REFERENCES accounts(id) ON DELETE CASCADE 
     TABLE "actions" CONSTRAINT "actions_account_id_fkey" FOREIGN KEY (account_id) REFERENCES accounts(id) ON DELETE CASCADE 
     TABLE "api_keys" CONSTRAINT "api_keys_account_id_fkey" FOREIGN KEY (account_id) REFERENCES accounts(id) ON DELETE CASCADE 
     TABLE "authorizations" CONSTRAINT "authorizations_account_id_fkey" FOREIGN KEY (account_id) REFERENCES accounts(id) ON DELETE CASCADE 
     TABLE "positions" CONSTRAINT "claims_account_id_fkey" FOREIGN KEY (account_id) REFERENCES accounts(id) ON DELETE CASCADE 
     TABLE "duplicates" CONSTRAINT "duplicates_account_id_fkey" FOREIGN KEY (account_id) REFERENCES accounts(id) ON DELETE CASCADE 
     TABLE "old_edits" CONSTRAINT "edits_account_id_fkey" FOREIGN KEY (account_id) REFERENCES accounts(id) 
     TABLE "edits" CONSTRAINT "edits_account_id_fkey1" FOREIGN KEY (account_id) REFERENCES accounts(id) ON DELETE CASCADE 

     etc...... etc...... 

制約がテーブルedits上に配置され、テーブルaccountsを変更しています。クエリのaccountseditsに変更すると正常に動作します。

関連する問題