Bugs item #1652661, was opened at 2007-02-05 11:31
Message generated for change (Comment added) made by nobody
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1652661&group_id=74338
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Postgres
Group: SQLObject release (specify)
Status: Closed
Resolution: Works For Me
Priority: 5
Private: No
Submitted By: Elvis Pfutzenreuter (epx)
Assigned to: Oleg Broytmann (phd)
Summary: orderBy with negative sign does not work for DateCol's
Initial Comment:
Version: SQLObject-0.7.3-py2.4.egg
While using select(..., orderBy=-datecolumn) works for MySQL, it fails for PostgreSQL. The report error is:
ERROR: operator does not exist: - timestamp without time zone\nHINT: No operator matches the given name and argument type(s). You may need to add explicit type casts.
Probably Postgres does not like arithmetic operations with timestamps/dates.
Removing the negative sign and doing select(orderby=datecolumn).reversed() works just fine.
----------------------------------------------------------------------
Comment By: Nobody/Anonymous (nobody)
Date: 2007-02-08 08:53
Message:
Logged In: NO
I was using Postgres 8.1, maybe it makes a difference.
----------------------------------------------------------------------
Comment By: Oleg Broytmann (phd)
Date: 2007-02-08 07:05
Message:
Logged In: YES
user_id=4799
Originator: NO
Works for me. The following program works with Postgres 7.4, SQLObject
0.7.3:
__connection__ = "postgres:/test?debug=1"
class Test(SQLObject):
dt = DateTimeCol()
Test.createTable()
from datetime import datetime
Test(dt=datetime(1967, 12, 21))
print Test.select(orderBy=Test.q.dt)
print list(Test.select(orderBy=Test.q.dt))
It produces the following output:
1/Query : CREATE TABLE test (
id SERIAL PRIMARY KEY,
dt TIMESTAMP
)
1/QueryR : CREATE TABLE test (
id SERIAL PRIMARY KEY,
dt TIMESTAMP
)
1/COMMIT : auto
1/QueryIns: INSERT INTO test (id, dt) VALUES (1, '1967-12-21 00:00:00')
1/COMMIT : auto
1/QueryOne: SELECT dt FROM test WHERE id = (1)
1/QueryR : SELECT dt FROM test WHERE id = (1)
1/COMMIT : auto
SELECT test.id, test.dt FROM test WHERE 1 = 1 ORDER BY test.dt
1/Select : SELECT test.id, test.dt FROM test WHERE 1 = 1 ORDER BY
test.dt
1/QueryR : SELECT test.id, test.dt FROM test WHERE 1 = 1 ORDER BY
test.dt
1/COMMIT : auto
[<Test 1L dt='datetime.datetime...)'>]
No problem.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1652661&group_id=74338
|