Hi all, Consider a table with a row function attached (in PostgreSQL), e.g.:
CREATE TABLE foo (id serial PRIMARY KEY, value int not null, v2 int not null); CREATE FUNCTION is_even(foo) RETURNS boolean STABLE STRICT AS $$ SELECT $1.value %2 = 0; $$ LANGUAGE SQL; (modulo typos and syntax errors). Now, I can access the function value like this: SELECT f.id, f.value, f.v2, f.is_even FROM foo f; or like this: my @foos = @{ Foo::Manager->get_objects }; print $_->is_even ? 'even' : 'odd' for @foos; So far, so good. RDBO handles it nicely (with a little patch to always qualify column names). As long as I remember to use changes_only => 1 in save, updates work fine too. However, the problem arises after calling: my ($a_foo) = @{ Foo::Manager->get_objects( query => [ id => 5, is_even => 0 ] ) }; $a_foo->v2( 5 ); $a_foo->save( changes_only => 1 ); The is_even condition is a result of my condition builder (e.g. a user may access any foo as long as its value is even). The rather weird call to a manager method to get one item is its artefact too. After executing the above snippet, RDBO wants to update the is_even column and gets barfed at by PostgreSQL (there's no is_even column). Apparently the setter for the is_even column is called within the get_objects function, but AIUI, this shouldn't result in marking the column modified. I appreciate any pointers and maybe a word or two about the Right Way to handle computed columns in RDBO. I'm using RDBO v.0.763. Best regards, Grzegorz Nosek ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Rose-db-object mailing list Rose-db-object@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rose-db-object