[SQL] Restricting a VIEW.

2002-10-19 Thread Terry Yapt
Hello all,

I have a doubt.  In the next example, I have a table with two columns:
- DATE
- MONEY

And a VIEW which SUM's the money GROUPing by 'month/year' (I cut off the day)...

Ok.. I would like to be able to SELECT * FROM VIEW.. but restricting by complete dates 
(dd/mm/)... (Last select in the example)

I think it isn't possible, but I would like to know your opinion... Or if there is any 
workaround...

Best regards..

--==
DROP TABLE ty_test;
CREATE TABLE ty_test
  (datein date NOT NULL,
   money  numeric(6,2) NOT NULL,
  PRIMARY KEY (datein)
) WITHOUT OIDS;

INSERT INTO ty_test VALUES ('2002/10/01',10);
INSERT INTO ty_test VALUES ('2002/10/15',20);
INSERT INTO ty_test VALUES ('2002/11/15',30);

DROP VIEW vw_ty_test;
CREATE VIEW vw_ty_test AS
SELECT
TO_CHAR(datein,'MM/') AS datein2,
SUM(money)
  FROM
ty_test
  GROUP BY
datein2;

SELECT * FROM ty_test;  -- All rows from table.
SELECT * FROM vw_ty_test;   -- All rows from view.

SELECT * FROM vw_ty_test WHERE datein BETWEEN '2002/10/01' AND '2002/10/9';
--==

---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly



[SQL] Comparing Numeric and Double Precision (float8)..

2002-11-04 Thread Terry Yapt
Hello all,

i DON'T know what is the proper forum to throw this question and I must
to insist in this "feature".  Sorry.

I have a lot of tables from Oracle 8i Databases with a lot of columns
with numeric(x,0) definition.

Ok.. I am traslating my oracle tables to PostgreSQL tables.  But I am
having a serious problem with my client aplications.

When I compare a numeric(x,0) field with a float8 field I have an error
on PostgreSQL what I didn't have with Oracle.  I mean:

CREATE test (one numeric(2,0));

SELECT * FROM test WHERE one = 1.0; 

This runs fine on my Oracle Systems.. but I have problems with my
PostgreSQL system.  I have tried to create an operator to workaround
this inconvenience:

numeric '=' float8
 with CREATE OPERATOR command and calling to a function to return a
boolean.

Ok.. great.. It is running now.  But when it runs.. I have another
problems comparing numeric with integers and so on.  So I must to DROP
OPERATOR..

I don't understand what is the problem and what options I have to
workaround it (without re-write a lot of client applications).

I have a lot of code I don't want to modify.  The question is:

Why we cannot compare numeric with double precision ?  And why Oracle or
SQL can do it without problems ?

Thanks a lot.

---(end of broadcast)---
TIP 6: Have you searched our list archives?

http://archives.postgresql.org



Re: [SQL] Comparing Numeric and Double Precision (float8)..

2002-11-04 Thread Terry Yapt
Great

I don't know if my customers can wait until 7.3 official release, but
I'll try to distract them a bit... :-\

Thanks a lot Bruno... 

Bruno Wolff III wrote:
> 
> On Mon, Nov 04, 2002 at 09:11:30 +0100,
>   Terry Yapt <[EMAIL PROTECTED]> wrote:
> >
> > When I compare a numeric(x,0) field with a float8 field I have an error
> > on PostgreSQL what I didn't have with Oracle.  I mean:
> >
> > CREATE test (one numeric(2,0));
> >
> > SELECT * FROM test WHERE one = 1.0;
> 
> With 7.3b3 the above works after correcting the create statement.
> bruno=> create table test (one numeric(2,0));
> CREATE TABLE
> bruno=> SELECT * FROM test WHERE one = 1.0;
>  one
> -
> (0 rows)

---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])



[SQL] Parameterized Views on 7.3

2002-12-21 Thread Terry Yapt
Hello all,

Are parameterized views already fully functional in 7.3 or I must use fuctions 
returning rows set ?

I have been looking for that in developer documentacion /7.3.1) and in the google 
groups but I haven't had so many luck.

Thanks.


---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])