<class 'psycopg2.OperationalError'>(lastval is not yet defined in this session
)
if db(db.user_role).isempty():
db.user_role.insert(id=1, title='Application Administrator')
db.user_role.insert(id=2, title='Account Administrator')
db.user_role.insert(id=3, title='Account Member')db.define_table('user_role',
Field('title', type='string', length=50, label=T('User Role Title'))
)
CREATE TABLE user_role
(
id serial NOT NULL,
title character varying(50),
CONSTRAINT user_role_pkey PRIMARY KEY (id )
)
WITH (
OIDS=FALSE
);
Yes you are right. Without id=1 it's working.
But if I insert data using postgres/psql with id=1, it doesn't give any error as well.
Regards,
AT
On Thursday, 26 June 2014 15:39:20 UTC+5, Simon Ashley wrote:
Seems to be a postgresql specific issue. Fails in the DAL at when executing 'select lastval()'. SQlite and MySQL are fine. The command also fails at the pg command line level. This was changed back in December but uncertain if the issue existed prior to this https://groups.google.com/forum/?fromgroups#!searchin/web2py/select$20lastval(). Only came across it 3 hours before you when attempting bulk_insert from a select.as_list() dict to move between databases. Cant see a quick or easy work around, and the issue probably needs a PR.
--You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/z-docU0cUN4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.--
Greg SierSier Associates AU--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
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 web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I tend to agree with this. We ended up dropping the id field from bulk_insert routines and if we need integrity (for references) in the target databases, we would/ should base it on other fields.