It sounds like this error can happen when you run an incorrect SQL 
statement within a transaction and then follow with another statement. Is 
it possible there is some earlier query you are running (maybe in one of 
your model files) that does not work in Postgres? What happens if you call 
db.rollback() right before running these queries that are generating the 
error?

Anthony

On Tuesday, July 31, 2018 at 7:48:26 AM UTC-4, Rahul wrote:
>
> Hi Anthony,
>         I am printing this to console - The query is trying to fetch 
> records that have an ETA in next 15 days
>
> print db(((db.issues.eta_date > today) & (db.issues.eta_date <= 
> fifteen_days_ahead)) & (db.issues.workspace == user_workspace) & (db.
> issues.created_by ==  logged_in_user))._select()
>
> Here is the query output (Just removed a few fields only in between as 
> there were many) - If needed I will send the entire query. 
> SELECT "issues"."id", "issues"."ticket_no", "issues"."project_name", 
> "issues"."sub_project", "issues"."team", "issues"."date_today", "issues".
> "category", "issues"."created_by", "issues"."workspace", "issues".
> "eta_date", "issues"."notify" FROM "issues" WHERE (((("issues"."eta_date" 
> > '2018-07-31') AND ("issues"."eta_date" <= '2018-08-14')) AND ("issues".
> "workspace" = 'WS1')) AND ("issues"."created_by" = 'rahul'));
>
> Let me know if anything else is needed - 
>
> Thank you
> Rahul 
>
>
> On Monday, July 30, 2018 at 11:23:05 PM UTC+5:30, Anthony wrote:
>>
>> Can you print out the raw SQL via ._select() so we can see exactly what 
>> is being sent to the database when the error occurs?
>>
>> On Monday, July 30, 2018 at 5:39:35 AM UTC-4, Rahul wrote:
>>>
>>> Okay I followed everyones instructions 
>>> I installed psycopg2 and the application is using this by default. 
>>> However it is giving me the same errors I got before. I did not earlier use 
>>> "%s" % but in the example I provided I just gave it a try as somewhere I 
>>> think it referred to a string issue. 
>>>
>>> 1.
>>> 2.
>>> 3.
>>> 4.
>>> 5.
>>> 6.
>>> 7.
>>> 8.
>>> 9.
>>> 10.
>>> 11.
>>> 12.
>>> 13.
>>> 14.
>>> 15.
>>> 16.
>>> 17.
>>> 18.
>>> 19.
>>> 20.
>>> 21.
>>> 22.
>>> 23.
>>>
>>> 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" 
>>> <http://127.0.0.1:8000/admin/default/edit/Target/controllers/default.py>, 
>>> line 15360, 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" 
>>> <http://127.0.0.1:8000/admin/default/edit/Target/controllers/default.py>, 
>>> line 714, in dashboard
>>>     alertRows=s.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\base.py", line 
>>> 412, in execute
>>>     rv = self.cursor.execute(command, *args[1:], **kwargs)
>>> InternalError: current transaction is aborted, commands ignored until end 
>>> of transaction block
>>>
>>>
>>> <class 'psycopg2.InternalError'> current transaction is aborted, 
>>> commands ignored until end of transaction block
>>>
>>>  Any suggestions?
>>>
>>> Rahul 
>>>
>>> On Sunday, July 29, 2018 at 10:24:07 PM UTC+5:30, Joe Barnhart wrote:
>>>>
>>>> I’d get rid of the idiom: 
>>>>
>>>> db.colname==“%s”%pythonvar 
>>>>
>>>> Just replace it with: 
>>>>
>>>> db.colname==pythonvar 
>>>>
>>>> — Joe
>>>
>>>

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