I have 3 tables:
CREATE TABLE IF NOT EXISTS site_shipping_method_configuration (
id INT GENERATED ALWAYS AS IDENTITY,
shipping_method_id uuid DEFAULT uuid_generate_v4(),
custom_id VARCHAR(255),
PRIMARY KEY(shipping_method_id);
CREATE TABLE IF NOT EXISTS public.channel (
channel_id integer NOT NULL GENERATED ALWAYS AS IDENTITY,
channel_name VARCHAR(50),
PRIMARY KEY(channel_id));
CREATE TABLE IF NOT EXISTS public.shipping_method_channel_mapping (
id integer NOT NULL GENERATED ALWAYS AS IDENTITY,
channel_id integer NOT NULL,
shipping_method_id integer NOT NULL,
PRIMARY KEY(id),
FOREIGN KEY (channel_id) REFERENCES channel (channel_id),
FOREIGN KEY (shipping_method_id) REFERENCES site_shipping_method_configuration (id));
I have to insert multiple values at once in 3rd table which contains two foreign keys from two tables (1st and 2nd). I already have values in first two tables.