Thanks, Niphlod.  Point taken.

As I think about this, I realize that there's no law requiring me to use 
the foreign table's primary key as the foreign key reference.

The only advantage in Postgres is the guaranteed uniqueness of the key. 
 But I should get the same results if I enforce uniqueness on some other 
field, then I should be able to use it as a reference.  Of course I would 
have to index it and not allow nulls or empties.

But in my other scenario I would want to index it anyway because it would 
be a search key, and same for null/empty.

So maybe that's my answer.


On Monday, March 11, 2013 5:17:40 AM UTC-4, Niphlod wrote:
>
> it's a problem on how to make it work without being heavily limited 
> performance-wise.
> Having a custom format almost kills the possibility to fetch those records 
> using an "automatic" join with the referenced table.
>
> It's one thing to fetch for every page the representation of the record 
> for 10 rows, it's a totally different thing have to search through 
> potentially thousands of records with everyone's ultra-custom formatter....
>
> If you need your users to scan the table "ala fulltext", don't use 
> references and formats: prepare a shallow copy table with real-text fields 
> instead of references.
>
> On Monday, March 11, 2013 2:50:56 AM UTC+1, Cliff Kachinske wrote:
>>
>> I define a table so:
>> db.define_table ('mytable', blah..., format='% (name) s')
>>
>> So as we know, grid will display the contents of the name field when 
>> mytable is used as a foreign table. 
>>
>> But if you try to search on that field, the search only works if you 
>> submit record id integers as search parameters. 
>>
>> Since human users don't generally know the record id or ids, this makes 
>> the search function less useful than it could be. 
>>
>> Has anyone worked around this?  If so, can you share your solution? 
>>
>> Thanks,  Cliff Kachinske
>>
>>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to