create database test; \connect test CREATE TABLE "t2" ( "nr2" integer, "t1" integer ); CREATE TABLE "t1" ( "nr1" integer, "typ" integer, "art" integer ); CREATE VIEW "feld" as SELECT * FROM t1, t2 WHERE t1.nr1 = t2.t1 UNION SELECT *, null, null FROM t1 WHERE t1.art = 1; insert into t2 values(4, 4); insert into t2 values(3, 3); insert into t1 values(1, 1, 1); insert into t1 values(2, 2, 1); insert into t1 values(3, 1, 2); insert into t1 values(4, 2, 2); select * from feld where typ=1; \c drop database test;