now I understand. Usually you use web2py with 'id' when web2py handles the 
creation of the tables, but you can use Field('whatever', 'id') with 
"legacy tables" that already exist. You, on the other hand, need to have a 
Field('whatever', 'id') in tables directly managed with web2py. That was 
the bit I was missing.

Sorry for not understanding earlier.

By all means, open a bug issue so we can fix it.

On Monday, June 10, 2013 6:09:45 PM UTC+2, Lionel Tokarz wrote:
>
> That's exactly how I define the tables.
>
> In fact the bug appears when web2py generate the database.  As there is no 
> automatic numbering in Oracle, it needs to generate a sequence containing 
> the value of the primary key and a trigger that get a new number and 
> attribute it to the primary key of a new record before inserting it in the 
> database.
>
> The trigger generated by web2py tries to attribute that value to a field 
> called 'id' that doesn't exist in the database as the primary key is called 
> 'acc_rn'.
>
> This is impossible to make an insert without modifying manually the 
> trigger in the database level (a simple modification that consists of 
> remplacing all the occurences of 'id' by 'acc_rn').
>
> For me it's a bug, but if I did something wrong I would be really happy to 
> find out what it is.
>
>
> Lionel
>
> Le lundi 10 juin 2013 17:29:49 UTC+2, Niphlod a écrit :
>>
>> uhm. I'm not sure I understood what is the bug if you defined tables as
>>
>> db.define_table('somwthing',
>>        Field('acc_rn', 'id'),
>>        Field('...'), ....
>> )
>>
>>
>>
>>
>> Il giorno lunedì 10 giugno 2013 15:56:53 UTC+2, Lionel Tokarz ha scritto:
>>>
>>> Ok, I will report it on google code this evening.
>>>
>>> Le lundi 10 juin 2013 15:16:08 UTC+2, Massimo Di Pierro a écrit :
>>>>
>>>> Thank you. Can you please open a ticket about this?
>>>>
>>>> On Monday, 10 June 2013 05:28:16 UTC-5, Lionel Tokarz wrote:
>>>>>
>>>>> Hello, 
>>>>>  
>>>>>  
>>>>> I'm using web2py since a few months and this is my first message on 
>>>>> this group.  I hope it's the right place to report what seems to be a 
>>>>> little bug.
>>>>>  
>>>>> I'm actually developping a web2py application on top of an oracle 
>>>>> database.  By convention, all the primary keys of the database have to be 
>>>>> rename as 'acc_rn'.
>>>>>  
>>>>> After the generation of the tables by web2py, a problem appears when 
>>>>> trying to insert a new record.  
>>>>>  
>>>>> In fact, the trigger generated by web2py to put a value in the primary 
>>>>> key field before insert tries to put that value in a field call 'id' that 
>>>>> doesn't exist here, and my acc_rn field is never initialised. 
>>>>>  
>>>>> I resolved the problem by rewriting all the triggers directly in the 
>>>>> database. 
>>>>>  
>>>>> This is not a big bug but I hope this report will help to make this 
>>>>> great framework getting even better.
>>>>>  
>>>>>  
>>>>> Sincerely yours, 
>>>>>  
>>>>> Lionel Tokarz
>>>>>  
>>>>>  
>>>>>  
>>>>>  
>>>>>
>>>>

-- 

--- 
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