Hi Everyone,
           I recently migrated my entire SQLite database to Postgre 9.x . 
While almost all my changes are working fine, I am getting errors for a few 
SQL statements like below for sections in my dashboard. 

(i) this statement  and below statement is throwing the error - However if 
I put the exact same statement in db.py and print the results it works 
flawlessly. I am confused why it is behaving this way. Does postgres 
require a different syntax for the queries we throw in DAL ? for count etc ?
teams_only = db((db.teams.workspace == user_workspace)).select(db.teams.
team_name)



(ii)
patches = db((db.patches.workspace == "%s" % user_workspace) & 
(db.patches.patchweek 
== "%s" % patchWeek) & (db.patches.patchyear == "%s" % patchYr)).select()



Error is common - for both 

<class 'gluon.contrib.pg8000.core.ProgrammingError'> (u'ERROR', u'25P02', 
u'current transaction is aborted, commands ignored until end of transaction 
block', u'src\\backend\\tcop\\postgres.c', u'1259', u'exec_parse_message', 
u'', u'')

Traceback

1.
2.

 Traceback (most recent call last):
  File "D:\web2py\web2py\gluon\restricted.py", line 219, in restricted
    exec(ccode, environment)
  File "D:/web2py/web2py/applications/Target/controllers/default.py", line 
15357, in <module>
  File "D:\web2py\web2py\gluon\globals.py", line 409, in <lambda>
    self._caller = lambda f: f()
  File "D:/web2py/web2py/applications/Target/controllers/default.py", line 
808, in dashboard
    APWK = activepatchesWK()  #active patches weekly
  File "D:/web2py/web2py/applications/Target/controllers/default.py", line 
14585, in activepatchesWK
    patches = db((db.patches.workspace == "%s" % user_workspace) & 
(db.patches.patchweek == "%s" % patchWeek) & (db.patches.patchyear == "%s" 
% patchYr)).select()
  File "D:\web2py\web2py\gluon\packages\dal\pydal\objects.py", line 2211, 
in select
    return adapter.select(self.query, fields, attributes)
  File "D:\web2py\web2py\gluon\packages\dal\pydal\adapters\base.py", line 
762, in select
    return self._select_aux(sql, fields, attributes, colnames)
  File "D:\web2py\web2py\gluon\packages\dal\pydal\adapters\base.py", line 
718, in _select_aux
    rows = self._select_aux_execute(sql)
  File "D:\web2py\web2py\gluon\packages\dal\pydal\adapters\base.py", line 
712, in _select_aux_execute
    self.execute(sql)
  File "D:\web2py\web2py\gluon\packages\dal\pydal\adapters\__init__.py", 
line 67, in wrap
    return f(*args, **kwargs)
  File "D:\web2py\web2py\gluon\packages\dal\pydal\adapters\postgres.py", 
line 190, in execute
    return super(PostgrePG8000, self).execute(*args, **kwargs)
  File "D:\web2py\web2py\gluon\packages\dal\pydal\adapters\__init__.py", 
line 67, in wrap
    return f(*args, **kwargs)
  File "D:\web2py\web2py\gluon\packages\dal\pydal\adapters\base.py", line 
412, in execute
    rv = self.cursor.execute(command, *args[1:], **kwargs)
  File "D:\web2py\web2py\gluon\contrib\pg8000\core.py", line 906, in execute
    self._c.execute(self, operation, args)
  File "D:\web2py\web2py\gluon\contrib\pg8000\core.py", line 1940, in 
execute
    self.handle_messages(cursor)
  File "D:\web2py\web2py\gluon\contrib\pg8000\core.py", line 2088, in 
handle_messages
    raise self.error
ProgrammingError: (u'ERROR', u'25P02', u'current transaction is aborted, 
commands ignored until end of transaction block', 
u'src\\backend\\tcop\\postgres.c', u'1259', u'exec_parse_message', u'', u'')
 
I have checked this for but no help - 
Postgres error 25P02 is for "transaction aborted" is returned with SQL 
State = "25P02".
https://www.postgresql.org/message-id/3D9BF154E1B04444B6D07D04B1F0CD4F5C0486%40ntk-mail2k3.nortak.com

My Environment - 
web2py Version 2.15.3-stable+timestamp
Windows 10
Python 2.7.13

Can anyone guide me in proper direction with Postgres query handling with 
DAL 

Thanks,
Rahul 

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to