Field('block_names_id', db.block_names, requires=IS_EMPTY_OR(
IS_IN_DB(db, 'block_names.id', '%(block_name)s'))
)
On Friday, April 27, 2012 8:00:34 AM UTC-4, Loreia 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
>