UNION and VIEW - Mailing list pgsql-bugs

From Roland Schulz
Subject UNION and VIEW
Date
Msg-id 3A7F119C.E5D268F4@web.de
Whole thread Raw
Responses Re: UNION and VIEW  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
Your name               : Roland Schulz
Your email address      : rschulz9@web.de


System Configuration
---------------------
  Architecture (example: Intel Pentium)         : Intel Pentium MMX

  Operating System (example: Linux 2.0.26 ELF)  : Linux 2.4.1 ELF

  PostgreSQL version (example: PostgreSQL-7.1):   PostgreSQL-7.1beta4

  Compiler used (example:  gcc 2.8.0)           : 2.95.2


Please enter a FULL description of your problem:
------------------------------------------------
When using UNION in a VIEW, the view displays always all records
disregarding any WHERE's. This problem didn't happen with beta1. The
SELECT in the example should only display the records where the field
'typ' is 1 not all records.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;

pgsql-bugs by date:

Previous
From: Peter T Mount
Date:
Subject: Re: Bug and Bugfix for the jdbc-driver
Next
From: "Nic Ferrier"
Date:
Subject: Re: [HACKERS] Re: syslog logging setup broken?