Re: [SQL] rule for update view that updates/inserts into 2 tables

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Chad Showalter <cshowalter(at)bplglobal(dot)net>
Cc: 'Robins Tharakan' <tharakan(at)gmail(dot)com>, pgsql-sql(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [SQL] rule for update view that updates/inserts into 2 tables
Date: 2008-04-15 15:41:07
Message-ID: 20080415154107.GE7024@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-sql

On Tue, Apr 15, 2008 at 11:27:15AM -0400, Chad Showalter wrote:
> I don't need to define the view the way I did in my example. I do need the
> view to have fields that map to fields in my_audit_table in order to do an
> insert into that table with values from the insert statement.

Right.

> Here's one solution that seems to work. Change my view to the following,
> leave rules the same as before:

Looks good, though I would've used NULLs instead of actual values, but
it doesn't matter.

The reason I was asking about the SP is that you could do:

SELECT insert_row(a,b,c);

With the appropriate procedure definition and it would still have one
roundtrip. But your way works also.

Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> Please line up in a tree and maintain the heap invariant while
> boarding. Thank you for flying nlogn airlines.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Chernow 2008-04-15 15:45:40 Re: pulling libpqtypes from queue
Previous Message Tom Lane 2008-04-15 15:38:16 Re: stack smashing detected

Browse pgsql-sql by date

  From Date Subject
Next Message Steve Midgley 2008-04-15 17:13:46 Re: export CSV file through Java JDBC
Previous Message Chad Showalter 2008-04-15 15:27:15 Re: rule for update view that updates/inserts into 2 tables