Re: [RDBO] RDBO and computed columns

2008-02-03 Thread John Siracusa
On Feb 3, 2008 5:07 PM, Grzegorz Nosek <[EMAIL PROTECTED]> wrote: > __PACKAGE__ > ->meta->column('is_even') > ->add_trigger('on_set', > sub { > unset_column_value_modified( $_[0], 'is_even' ) > }); > > R::DB::O::Util is imported earlier with :columns

Re: [RDBO] RDBO and computed columns

2008-02-03 Thread Grzegorz Nosek
On Sun, Feb 03, 2008 at 04:21:26PM -0500, John Siracusa wrote: > On Feb 3, 2008 3:59 PM, Grzegorz Nosek <[EMAIL PROTECTED]> wrote: > > my ($a_foo) = @{ Foo::Manager->get_objects( query => [ id => 5, is_even => > > 0 ] ) }; > > $a_foo->v2( 5 ); > > $a_foo->save( changes_only => 1 ); > > > > After e

Re: [RDBO] RDBO and computed columns

2008-02-03 Thread John Siracusa
On Feb 3, 2008 3:59 PM, Grzegorz Nosek <[EMAIL PROTECTED]> wrote: > 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

[RDBO] RDBO and computed columns

2008-02-03 Thread Grzegorz Nosek
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 t