Opened 20 years ago
Closed 19 years ago
#1794 closed defect (worksforme)
DateTimeField with unique=True broken
| Reported by: | Owned by: | Adrian Holovaty | |
|---|---|---|---|
| Component: | Core (Other) | Version: | dev |
| Severity: | normal | Keywords: | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
Using the DateTimeField with "unique=True" returns the following error, when inputting new values:
ProgrammingError at /django/admin/polls/poll/add/
ERROR: invalid input syntax for type timestamp with time zone: "16:08" SELECT "polls_poll"."id","polls_poll"."question","polls_poll"."pub_date" FROM "polls_poll" WHERE ("polls_poll"."pub_date" = '16:08')
Request Method: POST
Request URL: http://db-projects.org:8000/django/admin/polls/poll/add/
Exception Type: ProgrammingError
Exception Value: ERROR: invalid input syntax for type timestamp with time zone: "16:08" SELECT "polls_poll"."id","polls_poll"."question","polls_poll"."pub_date" FROM "polls_poll" WHERE ("polls_poll"."pub_date" = '16:08')
Exception Location: /usr/lib/python2.3/site-packages/django/db/backends/util.py in execute, line 12
The demonstration model:
class Poll(models.Model):
question = models.CharField(maxlength=200)
pub_date = models.DateTimeField('date published', unique=True)
def __str__(self):
return self.question
class Admin:
pass
It works without problems if I'm not using "unique=True".
SVN revision 2864
Postgresql 7.4.7
Python 2.3.5
Note:
See TracTickets
for help on using tickets.
I could not reproduce this error.