Conditional insert requires a query and, as you can see from the INSERT documentation, query and DEFAULT VALUES are in a exclusive group.
When explicitly defining what columns should be populated, you need to specify at least one. So something like this is also invalid:
INSERT INTO foo ()
SELECT 1
WHERE random() >= 0.5;
The only way I can think of to achieve the same effect is by explicitly defining the "default" value:
INSERT INTO foo (id)
SELECT nextval('foo_id_seq'::regclass)
WHERE random() > 0.8;
Or by adding another column
CREATE TABLE foo (
id bigserial PRIMARY KEY,
ignored SMALLINT
);
INSERT INTO foo (ignored)
SELECT 1
WHERE random() >= 0.5;
Edit:
Completely missed that you can do empty selects:
INSERT INTO foo
SELECT
WHERE random() >= 0.5;