From: | Mathieu Arnold <mat(at)mat(dot)cc> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | create view problem |
Date: | 2002-03-28 06:58:34 |
Message-ID: | 4876156.1017302314@sauron |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Hi
I had a view :
CREATE VIEW
trafic_day
AS
SELECT
stats.ip,
date(stats."time") AS date,
count(*) AS nb,
sum(stats.packet) AS packet,
sum(stats.traffic) AS traffic
FROM
stats
GROUP 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 VIEW
trafic_day
AS
SELECT
stats.ip,
date(stats."time") AS date,
count(*) AS nb,
sum(stats.packet) AS packet,
sum(stats.traffic) AS traffic
FROM
stats
WHERE
time::date < 'now'::date
GROUP 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
From | Date | Subject | |
---|---|---|---|
Next Message | Christopher Kings-Lynne | 2002-03-28 07:04:41 | Re: create view problem |
Previous Message | Rudi Starcevic | 2002-03-28 06:27:32 | Re: Database / table sizeof |