From: Mathieu Arnold <mat@mat.cc>
To: pgsql-sql@postgresql.org
Subject: create view problem
Date: Thu, 28 Mar 2002 07:58:34 +0100
Message-ID: <4876156.1017302314@sauron> (raw)
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: mat@mat.cc
Subject: Re: create view problem
In-Reply-To: <4876156.1017302314@sauron>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox