view with insert rule

From: Philipp Kraus <philipp(dot)kraus(at)flashpixx(dot)de>
To: pgsql-general(at)postgresql(dot)org
Subject: view with insert rule
Date: 2012-12-30 20:20:08
Message-ID: 605ED068-A330-40BB-A9AE-8D91A3FA7DFC@flashpixx.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello,

I use some views for creating some different accessibility of the table data. For inserting I use a rule, which works at the moment, but
my rules runs the SQL statement "insert into myschema.mytable values (new.*)"

If I run on my view the command: insert into myview (field1, field4) values ('first', 123)
it creates an error, because the base table has got some null constraints and other checks. If I create a full insert
statement like "insert into (field1, field2, field3, field4) values (...)" everything works fine.

Can I create a view, that can be used like a table, so on insert statements the default values are set? Can I do
this with trigger ?

Thanks

Phil

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2012-12-30 20:26:38 Re: view with insert rule
Previous Message Tom Lane 2012-12-30 17:34:57 Re: bug with indexing of infinite timestamps?