python-sql

Bug 60

classification
Title: Expression in AtTimeZone
Type: crash Severity: normal
Components: Versions:
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: ced Nosy List: ced, risto3, roundup-bot
Priority: normal Keywords: patch

Created on 2018-05-14 15:10 by ced, last changed 2018-05-16 23:52 by roundup-bot.

Messages
msg71 Author: [hidden] (ced) Date: 2018-05-14 15:10
It is allowed to use expression as timezone name for AtTimeZone.

Ref: https://bugs.tryton.org/msg40676
msg72 Author: [hidden] (ced) Date: 2018-05-14 15:11
Here is review48331002
msg73 Author: [hidden] (risto3) Date: 2018-05-14 15:52
I will try this, but I ask as well, I tried for readability
to get extra parens for the expression, e.g.

   select ((date at time zone 'UTC') at time zone
'TIMEZONE') ...

but nothing seemed to work... the result is always without
parens

perhaps line 479 in sql/functions.py could read:

       return '(%s AT TIME ZONE %s)' % (str(self.field), zone)

wouldn't that do it?
msg74 Author: [hidden] (ced) Date: 2018-05-14 16:24
There is no need for parenthesis, it is valid SQL without.
As it is generated SQL code, we do not add syntactic sugar.
msg75 Author: [hidden] (risto3) Date: 2018-05-14 16:47
ok, agreed.

for what it is worth, the patch works for me. +1
msg76 Author: [hidden] (roundup-bot) Date: 2018-05-16 23:52
New changeset f76ee6f5d2a7 by C├ędric Krier in branch 'default':
Allow to use expression in AtTimeZone
https://hg.tryton.org/python-sql/rev/f76ee6f5d2a7
History
Date User Action Args
2018-05-16 23:52:26roundup-botsetstatus: open -> closed
nosy: + roundup-bot
messages: + msg76
2018-05-14 16:47:35risto3setmessages: + msg75
2018-05-14 16:24:15cedsetmessages: + msg74
2018-05-14 15:52:28risto3setnosy: + risto3
messages: + msg73
2018-05-14 15:11:46cedsetstatus: new -> open
keywords: + patch
messages: + msg72
2018-05-14 15:10:56cedcreate