Return sample row if result set is empty What would be the most practical way to write a query, that returns single row in case of empty result set.

Something like (pseudosql)

(SELECT 1 AS c1, 2 AS c2 FROM ... WHERE ...) OR_ELSE(SELECT 0 AS c1, 0 AS c2)
You can use either generate_series function or VALUES Lists with a left join. The sample queries are below;

    CREATE TABLE my_table (a INT, b INT);
    INSERT INTO my_table VALUES (1,2), (2,2), (3,4);

    SELECT a, b FROM generate_series(1,1)
    LEFT JOIN my_table ON b = 5;

    |      a |      b |
    |--------|--------|
    | (null) | (null) |


    SELECT a, b FROM (values (1)) as one
    LEFT JOIN my_table ON b = 5;

    |      a |      b |
    |--------|--------|
    | (null) | (null) |


    SELECT a, b FROM generate_series(1,1)
    LEFT JOIN my_table ON b = 2;

    | a | b |
    |---|---|
    | 1 | 2 |
    | 2 | 2 |