Skip site navigation (1) Skip section navigation (2)

Re: possible mis-handling of nulls in views in 7.0.2

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: mark(at)summersault(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: possible mis-handling of nulls in views in 7.0.2
Date: 2001-03-13 00:09:11
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-bugs
Mark Stosberg <mark(at)summersault(dot)com> writes:
>    I'm running Postgres 7.0.2 and have run into a curious situation. I
> got a back a null value in a select on VIEW that is defined as not
> allowing that column to be null.

I think this is an artifact of the curious (not to say broken)
implementation of views pre-7.1.  However, it's hard to tell for sure
because I can't reproduce your problem.  Are you sure you are running
7.0.2 and not something older?  Can you provide a self-contained
example?  My test went like this:

play=> select version();
 PostgreSQL 7.0.2 on hppa2.0-hp-hpux10.20, compiled by gcc 2.95.2
(1 row)

play=> create table foo (f1 int, f2 int);
play=> insert into foo values(1,2);
INSERT 873546 1
play=> insert into foo values(1,3);
INSERT 873547 1
play=> insert into foo values(2,4);
INSERT 873548 1
play=> insert into foo values(2,5);
INSERT 873549 1
play=> create view v2 as select f1,sum(f2) from foo where f1 notnull group by f1;
CREATE 873571 1
play=> select * from v2 ;
 f1 | sum
  1 |   5
  2 |   9
(2 rows)

play=> select * from v2 where f1 isnull;
 f1 | sum
(0 rows)

			regards, tom lane

In response to


pgsql-bugs by date

Next:From: Mark StosbergDate: 2001-03-13 02:02:21
Subject: Re: possible mis-handling of nulls in views in 7.0.2
Previous:From: Tom LaneDate: 2001-03-12 23:43:08
Subject: Re: pgDump sequence dump bug

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group