削除ステートメントに問題があります。
私は2つのテーブルを持っています:
table vehicule_loan(
vehicule TEXT NOT NULL UNIQUE,
);
table vehicule_uid (
id UUID NOT NULL DEFAULT uuid_generate_v4(),
vehicule TEXT NOT NULL REFERENCES vehicule_loan(vehicule) ON DELETE NO ACTION
);
vehicule
テーブルからを削除するとき、テーブルvehicule_loan
内の参照行をvehicule_uid
保持する必要があります。
しかし、1つを削除しようとすると、次のエラーが発生します。
ERROR: update or delete on table "vehicule_loan" violates foreign key constraint "vehicule_uid_vehicule_fkey" on table "vehicule_uid"
私はエラーを理解していると思います:vehicule
テーブルからaを削除した後vehicule_loan
、vehicule
invehicule_uid
は何も指しません。
しかし、行を保持する方法はありvehicule_uid
ますか?