从MariaDB转换到postgres-10后,我将得到低于错误的数据,我使用的是Django-orm。
函数date_format(带有时区的时间戳,未知)不存在第1行:选择(DATE_FORMAT(created_at,'%h %p‘)作为"in_hours",和(. 提示:没有任何函数与给定的名称和参数类型匹配。您可能需要添加显式类型转换。
Model.objects.filter(franchise=franchise)\
.filter(created_at__date=date)\
.extra(select={'in_hours': "DATE_FORMAT(created_at,'%%h %%p')"}) \
.values('in_hours')\
.order_by('created_at__hour')\
.annotate(total_amount=Sum('amount'))有人能解释一下哪里出了问题吗。谢谢
发布于 2019-01-11 08:30:23
在Postgres中没有DATE_FORMAT函数,必须使用TO_CHAR https://www.postgresql.org/docs/9.1/functions-formatting.html
https://stackoverflow.com/questions/54142767
复制相似问题