User is a reserved keyword in postgres, you need to rename field

Marin

On 31 Dec 2011 09:42, "Plumo" <[email protected]> wrote:

I have an app working with sqlite. I tried changing to postgres and get
this error:

<class 'psycopg2.ProgrammingError'>(syntax error at or near "user" LINE 3:
user INTEGER REFERENCES auth_user(id) ON DELETE CASCADE, ^ )

This is the relevant table:

db.define_table('purchase',
    Field 
<https://web2py_admin.baron.webfactional.com/examples/global/vars/Field>('user',
db.auth_user),
    Field 
<https://web2py_admin.baron.webfactional.com/examples/global/vars/Field>('database',
db.database),
    Field 
<https://web2py_admin.baron.webfactional.com/examples/global/vars/Field>('txn_id',
unique=True),
    Field 
<https://web2py_admin.baron.webfactional.com/examples/global/vars/Field>('price',
'decimal(8,2)', required=True, requires=IS_DECIMAL_IN_RANGE
<https://web2py_admin.baron.webfactional.com/examples/global/vars/IS_DECIMAL_IN_RANGE>(0,
1e100)),
    Field 
<https://web2py_admin.baron.webfactional.com/examples/global/vars/Field>('created',
'datetime', compute=now),
)


Any ideas? The auth_user table is the default.

Richard

Reply via email to