The following fails to parse (in all dialects except SQLite):
INSERT INTO foo (a)
SELECT id FROM foo join bar
ON CONFLICT DO NOTHING;
Wrapping select to parenthesis fixes it:
INSERT INTO foo (a)
(SELECT id FROM foo join bar)
ON CONFLICT DO NOTHING;
Or adding some other clause after FROM:
INSERT INTO foo (a)
SELECT id FROM foo join bar WHERE true
ON CONFLICT DO NOTHING;
Or selecting from just single table
INSERT INTO foo (a)
SELECT id FROM foo
ON CONFLICT DO NOTHING;
The problem seems to be that ON CONFLICT gets confused with JOIN ... ON syntax.