# Re: Another motivational example for inverse view

From: jlfoster <jlfoster_at_sprintpcs.kawm.INVALID>

Date: Wed, 15 Nov 2006 13:09:26 -0800

Message-ID: <bdCdnWEUE-iMH8bYnZ2dnUVZ_sOdnZ2d_at_got.net>

Date: Wed, 15 Nov 2006 13:09:26 -0800

Message-ID: <bdCdnWEUE-iMH8bYnZ2dnUVZ_sOdnZ2d_at_got.net>

"Aloha Kakuikanu" <aloha.kakuikanu_at_yahoo.com> wrote in message news:1163554254.753687.167440_at_f16g2000cwb.googlegroups.com...

> Consider

*>
**> table PolarCoordinates (
**> theta real,
**> R real,
**> )
**>
**> with constraints R>0, 0<=theta<pi
**>
**> view CartesianCoordinates
**> select R*cos(theta) AS x, R*sin(theta) AS y
**> from PolarCoordinates
**>
**> This view is clearly updateable, all we need to do is to apply inverse
**> mapping to the any tuple inserted/updated/deleted.
**>
**> We can even write inverse view explicitly:
**>
**> view PolarCoordinates
**> select sqrt(x*x+y*y) AS R, arcsin(y/sqrt(x*x+y*y)) as theta
**> from PolarCoordinates
*

A real type system would make this a piece of cake. Received on Wed Nov 15 2006 - 22:09:26 CET