Scalatra / Slick and insert IF NOT EXISTS
问题 I am a newbie so hoping for some patience. :) I am trying to populate two tables if a value does not exist. Basically I have: TABLE b ( id VARCHAR(254) PRIMARY KEY NOT NULL ); TABLE d ( id VARCHAR(254) PRIMARY KEY NOT NULL, relay INT NOT NULL, FOREIGN KEY ( relay ) REFERENCES b ( id ) ); so I am trying to write a function that populates the two tables with a new value, if it doesn't exist, or ignores it otherwise... of course wrapped in a transaction: IF (NOT EXISTS(SELECT * FROM b where id=