CREATE FUNCTION get_user_email(username text) RETURNS text AS $$ CLUSTER 'userdb'; RUN ON hashtext(username); $$ LANGUAGE plproxy;The integrity of this setup depends on (among other things) the hash function always giving the same result for the same username. Otherwise your calls go to the wrong partition and you won't find your data again.
Unfortunately, the hashtext() function and other hash functions have changed their implementation between PostgreSQL 8.3 and 8.4. Observe:
8.3=> SELECT hashtext('foobar'); hashtext ----------- 504683490 (1 row) 8.4=> SELECT hashtext('foobar'); hashtext ----------- 289967942 (1 row)So when you update your proxy database from 8.3 to 8.4, you will likely make all your data invisible and/or create a big mess.
Solution? Well, in the short run: don't update quite yet. If you're just starting or you have a small database, reload all your data through the proxy instance after upgrading. The best solution for now appears to be forward-porting 8.3's hash function to 8.4 as an add-on module. Eventually, it would probably be best if PL/Proxy itself provided a stable set of hash functions.