Hi Bruce, G-mail failed to warn me about your answer, so I noticed it only today. Thanks a lot, it worked like a charm.
The same code worked in sqlite, but I guess Postgres is more restrictive. Thank you and BR Loreia On Friday, April 27, 2012 4:13:33 PM UTC+2, Bruce Wade wrote: > > (db.block_names.id == db.block_data.block_names_id) > db.block_names.id is an integer > db.block_data.block_names_id is a character varying. > > update db.define_tables("block_data", > Field("block_names_id", "integer", default=None) > > On Fri, Apr 27, 2012 at 5:00 AM, Loreia <...@gmail.com> wrote: > >> Hi, >> >> I define two tables in my application as: >> >> db.define_table( "block_names" >> , Field("block_name" ,default=None) >> ) >> >> db.define_table( "block_data" >> , Field("block_names_id" ,default=None) >> , Field("product_number" ,default=None) >> , Field("product_revision" ,default=None) >> , Field("product_path" ,default=None) >> , Field("branch" ,default=None) >> , Field("bat_file_path" ,default=None) >> , Field("toolbox" ,default=None) >> ) >> >> I am trying to run following query: >> rows = db((db.block_names.id > 0) >> &(db.block_names.id == >> db.block_data.block_names_id)).select(db.block_names.block_name, >> db.block_data.ALL) >> >> And I get this error: >> File ".../sqr_enumerate_pairs.py", line 77, in EnumeratePairs >> &(db.block_names.id == >> db.block_data.block_names_id)).select(db.block_names.block_name, >> db.block_data.ALL) >> File "/.../web2py/gluon/dal.py", line 7578, in select >> return adapter.select(self.query,fields,attributes) >> File "/.../web2py/gluon/dal.py", line 1315, in select >> rows = response(sql) >> File "/.../web2py/gluon/dal.py", line 1305, in response >> self.execute(sql) >> File "/.../web2py/gluon/dal.py", line 1392, in execute >> return self.log_execute(*a, **b) >> File "/.../web2py/gluon/dal.py", line 1386, in log_execute >> ret = self.cursor.execute(*a, **b) >> ProgrammingError: operator does not exist: integer = character varying at >> character 309 >> HINT: No operator matches the given name and argument type(s). You might >> need to add explicit type casts. >> >> I am using latest 1.99.7 Web2py, latest 9.1.2 Postgres, and latest 2.4.4 >> psycopg2 driver. >> >> Any help is welcomed :-) >> >> BR >> Loreia >> > > > > -- > -- > Regards, > Bruce Wade > http://ca.linkedin.com/in/brucelwade > http://www.wadecybertech.com > http://www.fittraineronline.com - Fitness Personal Trainers Online > http://www.warplydesigned.com > >