On Aug 4, 2006, at 10:07, Dan Horne wrote: > So, my question is: Is there any way to create such a pseudocolumn > that can > be populated as a result of the values of the other columns?
If you want to use a real column, you can add it to your table and then add a trigger to the table to compute the hash. Something like this (in PostgreSQL): CREATE OR REPLACE FUNCTION hash_row() RETURNS trigger AS $$ NEW.hash = md5(NEW.foo || NEW.bar || NEW.baz); RETURN NEW; $$ LANGUAGE sql; CREATE TRIGGER hash_row BEFORE UPDATE OR INSERT ON mytable FOR EACH ROW EXECUTE PROCEDURE hash_row(); Best, David _______________________________________________ List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class Wiki: http://dbix-class.shadowcatsystems.co.uk/ IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/ Searchable Archive: http://www.mail-archive.com/[email protected]/
