I am trying to do an INSERT within PostgreSQL query but getting an error when I try to implement COALESCE operator..
What I try to accomplish is that if the id value in team_member if found, insert created_by_team_member_id column.
INSERT INTO publish_queue
(status, created_by_team_member_id = COALESCE(created_by_team_member_id,
(SELECT id FROM team_member WHERE member_id = 1 AND team_id = 16 LIMIT 1))
)
VALUES ('Welcome!');
And the error:
syntax error at or near "="\nLINE 15:
created_by_team_member_id = COALESCE(created...\n
I am still not certain what you want to do, but perhaps it is