CREATE TABLE xonstat.player_map_captimes ( player_map_captime_id serial NOT NULL, player_id integer NOT NULL, map_id integer NOT NULL, game_id bigint NOT NULL, fastest_cap interval NOT NULL, mod character varying(64), create_dt timestamp without time zone NOT NULL DEFAULT (current_timestamp at time zone 'UTC'), CONSTRAINT player_map_captimes_pk PRIMARY KEY (player_map_captime_id), CONSTRAINT player_map_captimes_uk01 UNIQUE (player_id, map_id, mod), CONSTRAINT player_map_captimes_fk01 FOREIGN KEY (player_id) REFERENCES xonstat.players (player_id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION, CONSTRAINT player_map_captimes_fk02 FOREIGN KEY (map_id) REFERENCES xonstat.maps (map_id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION -- I have no idea why this causes an integrity constraint error, -- but it does. Since it is not critical, I'll drop it off for now, -- until I get a clue as to why the error happens. -- , -- CONSTRAINT player_map_captimes_fk03 FOREIGN KEY (game_id) -- REFERENCES xonstat.games (game_id) MATCH SIMPLE -- ON UPDATE NO ACTION ON DELETE NO ACTION ) WITH ( OIDS=FALSE ); ALTER TABLE xonstat.player_map_captimes OWNER TO xonstat;