3 Added patch link
source | link

Just useOnce you get the patch that allows that functionality more here

Just use: ELEMENT REFERENCES relation( field )

For intance:

CREATE TABLE drivers (
   driver_id integer PRIMARY KEY,
   first_name text,
   last_name text,
   ...
);



CREATE TABLE races (
   race_id integer PRIMARY KEY,
   title text,
   race_day DATE,
   ...
   practice1_positions integer[] ELEMENT REFERENCES drivers,
   practice2_positions integer[] ELEMENT REFERENCES drivers,
   practice3_positions integer[] ELEMENT REFERENCES drivers,
   qualifying_positions integer[] ELEMENT REFERENCES drivers,
   final_positions integer[] ELEMENT REFERENCES drivers
);

Just use the ELEMENT REFERENCES relation( field )

For intance:

CREATE TABLE drivers (
   driver_id integer PRIMARY KEY,
   first_name text,
   last_name text,
   ...
);



CREATE TABLE races (
   race_id integer PRIMARY KEY,
   title text,
   race_day DATE,
   ...
   practice1_positions integer[] ELEMENT REFERENCES drivers,
   practice2_positions integer[] ELEMENT REFERENCES drivers,
   practice3_positions integer[] ELEMENT REFERENCES drivers,
   qualifying_positions integer[] ELEMENT REFERENCES drivers,
   final_positions integer[] ELEMENT REFERENCES drivers
);

Once you get the patch that allows that functionality more here

Just use: ELEMENT REFERENCES relation( field )

For intance:

CREATE TABLE drivers (
   driver_id integer PRIMARY KEY,
   first_name text,
   last_name text,
   ...
);



CREATE TABLE races (
   race_id integer PRIMARY KEY,
   title text,
   race_day DATE,
   ...
   practice1_positions integer[] ELEMENT REFERENCES drivers,
   practice2_positions integer[] ELEMENT REFERENCES drivers,
   practice3_positions integer[] ELEMENT REFERENCES drivers,
   qualifying_positions integer[] ELEMENT REFERENCES drivers,
   final_positions integer[] ELEMENT REFERENCES drivers
);
2 added 70 characters in body
source | link

Just use the 'ELEMENT REFERENCES relation( field )'

FOR INSTANCE

CREATE TABLEELEMENT driversREFERENCES relation( driver_id integer PRIMARY KEY, first_name text, last_name text, field ... );

CREATE TABLE races ( race_id integer PRIMARY KEY, title text, race_day DATE, ... practice1_positions integer[] ELEMENT REFERENCES drivers, practice2_positions integer[] ELEMENT REFERENCES drivers, practice3_positions integer[] ELEMENT REFERENCES drivers, qualifying_positions integer[] ELEMENT REFERENCES drivers, final_positions integer[] ELEMENT REFERENCES drivers ); For intance:

CREATE TABLE drivers (
   driver_id integer PRIMARY KEY,
   first_name text,
   last_name text,
   ...
);



CREATE TABLE races (
   race_id integer PRIMARY KEY,
   title text,
   race_day DATE,
   ...
   practice1_positions integer[] ELEMENT REFERENCES drivers,
   practice2_positions integer[] ELEMENT REFERENCES drivers,
   practice3_positions integer[] ELEMENT REFERENCES drivers,
   qualifying_positions integer[] ELEMENT REFERENCES drivers,
   final_positions integer[] ELEMENT REFERENCES drivers
);

Just use the 'ELEMENT REFERENCES relation( field )'

FOR INSTANCE

CREATE TABLE drivers ( driver_id integer PRIMARY KEY, first_name text, last_name text, ... );

CREATE TABLE races ( race_id integer PRIMARY KEY, title text, race_day DATE, ... practice1_positions integer[] ELEMENT REFERENCES drivers, practice2_positions integer[] ELEMENT REFERENCES drivers, practice3_positions integer[] ELEMENT REFERENCES drivers, qualifying_positions integer[] ELEMENT REFERENCES drivers, final_positions integer[] ELEMENT REFERENCES drivers );

Just use the ELEMENT REFERENCES relation( field )

For intance:

CREATE TABLE drivers (
   driver_id integer PRIMARY KEY,
   first_name text,
   last_name text,
   ...
);



CREATE TABLE races (
   race_id integer PRIMARY KEY,
   title text,
   race_day DATE,
   ...
   practice1_positions integer[] ELEMENT REFERENCES drivers,
   practice2_positions integer[] ELEMENT REFERENCES drivers,
   practice3_positions integer[] ELEMENT REFERENCES drivers,
   qualifying_positions integer[] ELEMENT REFERENCES drivers,
   final_positions integer[] ELEMENT REFERENCES drivers
);
1
source | link

Just use the 'ELEMENT REFERENCES relation( field )'

FOR INSTANCE

CREATE TABLE drivers ( driver_id integer PRIMARY KEY, first_name text, last_name text, ... );

CREATE TABLE races ( race_id integer PRIMARY KEY, title text, race_day DATE, ... practice1_positions integer[] ELEMENT REFERENCES drivers, practice2_positions integer[] ELEMENT REFERENCES drivers, practice3_positions integer[] ELEMENT REFERENCES drivers, qualifying_positions integer[] ELEMENT REFERENCES drivers, final_positions integer[] ELEMENT REFERENCES drivers );