create view problem - Mailing list pgsql-sql

From Mathieu Arnold
Subject create view problem
Date
Msg-id 4876156.1017302314@sauron
Whole thread Raw
Responses Re: create view problem
List pgsql-sql
Hi

I had a view :
CREATE VIEWtrafic_day
ASSELECT stats.ip, date(stats."time") AS date, count(*) AS nb, sum(stats.packet) AS packet, sum(stats.traffic) AS
trafficFROMstatsGROUP BY stats.ip, date(stats."time")ORDER BY sum(stats.traffic) DESC;
 

I wanted to add some test on time, so I did a
CREATE VIEWtrafic_day
ASSELECT stats.ip, date(stats."time") AS date, count(*) AS nb, sum(stats.packet) AS packet, sum(stats.traffic) AS
trafficFROMstatsWHERE time::date < 'now'::dateGROUP BY stats.ip, date(stats."time")ORDER BY sum(stats.traffic) DESC;
 

which

show up as :

=> select definition from pg_views where viewname = 'trafic_day';
SELECT stats.ip, date(stats."time") AS date, count(*) AS nb, 
sum(stats.packet) AS packet, sum(stats.traffic) AS traffic FROM stats WHERE 
(date(stats."time") < '2002-03-28'::date) GROUP BY stats.ip, 
date(stats."time") ORDER BY sum(stats.traffic) DESC;

the 'now' is gone and I have the value of it instead of what I wanted...

-- 
Mathieu Arnold


pgsql-sql by date:

Previous
From: Rudi Starcevic
Date:
Subject: Re: Database / table sizeof
Next
From: "Christopher Kings-Lynne"
Date:
Subject: Re: create view problem