faking writable views as tables

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

faking writable views as tables

Enrico Weigelt

Hi folks,


I'm using several writable views (-> update & insert rules)
and got trouble with pgadmin - it refuses to insert/edit
values since it sees the table as a view and believes views
are never writable.

So i've just set the reltype in pg_class to 'r'. The frontends
now see it as a writeble table again, but when dropping the
table, i've got a warning, that some file (seems to be
<oid-of-schema>/<oid-of-table>) could not be deleted.
Is this the table storage file, which simply doesn't exist
on views ?

Are my changes to pg_class dangerous in any way ?


cu
--
---------------------------------------------------------------------
 Enrico Weigelt    ==   metux IT service
  phone:     +49 36207 519931         www:       http://www.metux.de/
  fax:       +49 36207 519932         email:     [hidden email]
---------------------------------------------------------------------
  Realtime Forex/Stock Exchange trading powered by postgresSQL :))
                                            http://www.fxignal.net/
---------------------------------------------------------------------

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings
Reply | Threaded
Open this post in threaded view
|

Re: faking writable views as tables

David Fetter
On Wed, Jun 29, 2005 at 01:56:04PM +0200, Enrico Weigelt wrote:
>
> Hi folks,
>
>
> I'm using several writable views (-> update & insert rules)
> and got trouble with pgadmin - it refuses to insert/edit
> values since it sees the table as a view and believes views
> are never writable.

That would be a pgadmin bug.  Please report it to them.

> So i've just set the reltype in pg_class to 'r'. The frontends
> now see it as a writeble table again, but when dropping the
> table, i've got a warning, that some file (seems to be
> <oid-of-schema>/<oid-of-table>) could not be deleted.
> Is this the table storage file, which simply doesn't exist
> on views ?
>
> Are my changes to pg_class dangerous in any way ?

Yes.

The current way to do writeable VIEWs is through the RULE system, not
with TRIGGERs :)

Cheers,
D
--
David Fetter [hidden email] http://fetter.org/
phone: +1 510 893 6100   mobile: +1 415 235 3778

Remember to vote!

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