Search Postgresql Archives

Re: Rule system and unsucessful updates.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Tom Lane wrote:
> The above is a pretty bad idea in any case --- think about what happens
> when you have some data in the table.  It'll set *every row* to id = 1
> and data = 'test'.  

Your right, DUH, I forgot my where clause in my example.  It is in the
real query though, perhaps I didn't get enough coffee this morning.

The reason nothing happens when there is nothing in
> the table is that there is no row that can be updated.  Taking an action
> "instead of" an action that doesn't happen still doesn't happen.
>
> For what I think you want this application to do, it'd make more sense
> for the application to say "INSERT some-data", and for you to have a
> rule that changes that into an UPDATE if there is a pre-existing row
> with matching key columns.

I'll go with updating instead of inserting in the rule, however I am
curious, is there a way to make an ON UPDATE rule work regardless if the
original query updated rows or not?  I was under the impression that the
rule engine just looked at the query syntax not what it did.

schu


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux