Do you mean after the step where I edited the data?  There was only one 
row.  I edited it manually and I could see the change in the appadmin table 
view, so I conclude the change was committed.

No data was lost as far as I can tell.

I didn't look at the backend with pgAdmin, though.  

On Wednesday, October 24, 2012 9:23:14 AM UTC-4, Richard wrote:
>
> Did you have a look at the backend with pgAdmin for ex`
> Richard
>
> On Wed, Oct 24, 2012 at 8:48 AM, Cliff Kachinske 
> <[email protected]<javascript:>
> > wrote:
>
>> System: Ubuntu 12.4 LTS, Web2py 2.0.9, Postgres 9, psycopg2
>>
>> In the model, start with a table like this:
>>
>> db.define_table('subject_revisions',
>>         Field('subject_id', 'reference subjects', 
>>             readable=False, writable=False,),
>>         Field('revision', length=32),
>>         Field('effective_date', 'date', requires=IS_EMPTY_OR(IS_DATE())),
>>         )
>>
>> We are going to attempt to change revision to a required integer. 
>>
>> First, comment it out so Postgres drops the column.
>> db.define_table('subject_revisions',
>>         Field('subject_id', 'reference subjects', 
>>             readable=False, writable=False,),
>>         # Field('revision', length=32),
>>         Field('effective_date', 'date', requires=IS_EMPTY_OR(IS_DATE())),
>>         )
>>
>> Then put it back as an integer field.
>> b.define_table('subject_revisions',
>>         Field('subject_id', 'reference subjects', 
>>             readable=False, writable=False,),
>>         Field('revision', 'integer'),
>>         Field('effective_date', 'date', requires=IS_EMPTY_OR(IS_DATE())),
>>         )
>>
>> Now using the admin interface, make sure that all entries in the table 
>> have an integer value in the field.
>>
>> Make the field required.
>> b.define_table('subject_revisions',
>>         Field('subject_id', 'reference subjects', 
>>             readable=False, writable=False,),
>>         Field('revision', length=32, required=True),
>>         Field('effective_date', 'date', requires=IS_EMPTY_OR(IS_DATE())),
>>         )
>>
>> So far so good.  Refresh the admin interface and observe no errors.
>>
>> Now try to tell Postgres to not allow nulls.  Make this change to the 
>> field def:
>>         Field('revision', length=32, required=True, notnull=True),
>>
>> Postgres chokes with this error:
>>
>> IntegrityError: column "revision__tmp" contains null values
>>
>>
>> Remove the notnull constraint and attempt to refresh the admin interface.  
>> Rocket will hang at this point.
>>
>>
>>
>>  -- 
>>  
>>  
>>  
>>
>
>

-- 



Reply via email to