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: 7856.984442151@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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();
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);
CREATE
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

Responses

Browse pgsql-bugs by date

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