在PostgreSQL 8中,是否可以ON DELETE CASCADES
在不丢弃后者的情况下添加到下表中的两个外键?
# \d scores
Table "public.scores"
Column | Type | Modifiers
---------+-----------------------+-----------
id | character varying(32) |
gid | integer |
money | integer | not null
quit | boolean |
last_ip | inet |
Foreign-key constraints:
"scores_gid_fkey" FOREIGN KEY (gid) REFERENCES games(gid)
"scores_id_fkey" FOREIGN KEY (id) REFERENCES users(id)
Run Code Online (Sandbox Code Playgroud)
两个引用的表都在下面 - 这里:
# \d games
Table "public.games"
Column | Type | Modifiers
----------+-----------------------------+----------------------------------------------------------
gid | integer | not null default nextval('games_gid_seq'::regclass)
rounds | integer | …
Run Code Online (Sandbox Code Playgroud) postgresql cascade constraints cascading-deletes postgresql-8.4