Hi, I use PostgreSQL as my database instead of MySQL. I found an issue with your schema. For "g_itemid" you use a varchar(11) but every where else in gallery2 it is an integer. This causes issues with PostgreSQL and your WHERE IN (); clauses. I changed your schema to type integer. I had to remove your SUBSTRING lines in mapHelper.class and then your module works with PostgresSQL.
Thanks, I'm aware of that issue. It's a legacy problem. The field was changed to varchar to implement groups (groups have a "G" prefix), but that method needs to be changed.