<!DOCTYPE html><html><head><title></title></head><body><div>An update for any future readers.<br><br><div>The database itself has the timezone on the relevant columns:</div><div><br></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;">kallithea=# \d repositories</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> Table "public.repositories"</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> Column | Type | Collation | Nullable | Default</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;">------------------+--------------------------+-----------+----------+-----------------------------------------------</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;">repo_id | bigint | | not null | nextval('repositories_repo_id_seq'::regclass)</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;">repo_name | text | | |</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;">repo_state | text | | |</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;">clone_uri | text | | |</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;">repo_type | text | | |</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;">user_id | bigint | | |</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;">private | boolean | | |</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;">statistics | boolean | | |</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;">downloads | boolean | | |</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;">description | text | | |</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;">created_on | timestamp with time zone | | |</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;">updated_on | timestamp with time zone | | |</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;">landing_revision | text | | |</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;">changeset_cache | bytea | | |</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;">fork_id | bigint | | |</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;">group_id | bigint | | |</span></div><div><br></div><div><br></div><div>This is the state of the database when exported from sqlite/imported into postgres. I can see that this is not the same if I build the database from Kallithea directly (these fields are set to "without timezone")</div><div><br></div><div>I used pgloader to transfer the data across to postgres from sqlite.</div><div>Solution was straightforward. Building the DB using Kallithea and then using the following load script for pgloader avoids the schema rebuild:</div><div><br></div><div><br></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;">load database</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> from sqlite:///mnt/kallithea.db</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> into postgresql://kallithea:pass@vcs:5432/kallithea</span></div><div><br></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;">with truncate, data only</span></div><div><br></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> set work_mem to '16MB', maintenance_work_mem to '512 MB';</span></div><div><br></div><div><br></div><div>Regards</div><div>Jamie</div><div><br></div></div><div><br></div><div>On Tue, 19 Aug 2025, at 12:15 PM, Jamie Love wrote:</div><blockquote type="cite" id="qt" style=""><div>Hi there,</div><div><br></div><div>Before going into the code and fixing this myself, I was wondering if anyone had come across the following error before. This is with the latest version of the code from the repository.</div><div><br></div><div>This occurs with Postgres, but not with SQLite (we have had to roll back from postgres to SQLite because of this error):</div><div><br></div><div><b> </b><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"><b>File "/home/kallithea/kallithea/kallithea/lib/webutils.py", line 577, in age</b></span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"><b> if prevdate > now:</b></span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"><b>TypeError: can't compare offset-naive and offset-aware datetimes</b></span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"><b>Traceback (most recent call last):</b></span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> File "/home/kallithea/kallithea/venv/lib/python3.9/site-packages/tg/appwrappers/session.py", line 71, in __call__</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> response = self.next_handler(controller, environ, context)</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> File "/home/kallithea/kallithea/venv/lib/python3.9/site-packages/tg/appwrappers/i18n.py", line 71, in __call__</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> return self.next_handler(controller, environ, context)</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> File "/home/kallithea/kallithea/venv/lib/python3.9/site-packages/tg/wsgiapp.py", line 243, in _dispatch</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> return controller(environ, context)</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> File "/home/kallithea/kallithea/kallithea/controllers/base.py", line 531, in __call__</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> return super(BaseController, self).__call__(environ, context)</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> File "/home/kallithea/kallithea/venv/lib/python3.9/site-packages/tg/controllers/dispatcher.py", line 118, in __call__</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> response = self._perform_call(context)</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> File "/home/kallithea/kallithea/venv/lib/python3.9/site-packages/tg/controllers/dispatcher.py", line 107, in _perform_call</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> r = self._call(action, params, remainder=remainder, context=context)</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> File "/home/kallithea/kallithea/venv/lib/python3.9/site-packages/tg/controllers/decoratedcontroller.py", line 129, in _call</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> output = controller_caller(context_config, bound_controller_callable, remainder, params)</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> File "/home/kallithea/kallithea/venv/lib/python3.9/site-packages/tg/controllers/decoration.py", line 21, in _decorated_controller_caller</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> return application_controller_caller(tg_config, controller, remainder, params)</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> File "/home/kallithea/kallithea/venv/lib/python3.9/site-packages/tg/configurator/components/dispatch.py", line 114, in _call_controller</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> return controller(*remainder, **params)</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> File "/home/kallithea/kallithea/kallithea/controllers/admin/repo_groups.py", line 278, in show_by_name</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> return self.show(group_name)</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> File "/home/kallithea/kallithea/venv/lib/python3.9/site-packages/decorator.py", line 232, in fun</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> return caller(func, *(extras + args), **kw)</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> File "/home/kallithea/kallithea/kallithea/lib/auth.py", line 575, in __wrapper</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> return func(*fargs, **fkwargs)</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> File "/home/kallithea/kallithea/kallithea/controllers/admin/repo_groups.py", line 291, in show</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> c.data = RepoModel().get_repos_as_dict(repos_list,</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> File "/home/kallithea/kallithea/kallithea/model/repo.py", line 178, in get_repos_as_dict</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> "last_change": last_change(repo.last_db_change),</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> File "/home/kallithea/kallithea/kallithea/model/repo.py", line 130, in last_change</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> return _render("last_change", last_change)</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> File "/home/kallithea/kallithea/kallithea/model/repo.py", line 102, in _render_datatable</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> return tmpl.render_unicode(</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> File "/home/kallithea/kallithea/venv/lib/python3.9/site-packages/mako/template.py", line 439, in render_unicode</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> return runtime._render(</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> File "/home/kallithea/kallithea/venv/lib/python3.9/site-packages/mako/runtime.py", line 874, in _render</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> _render_context(</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> File "/home/kallithea/kallithea/venv/lib/python3.9/site-packages/mako/runtime.py", line 920, in _render_context</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> _exec_template(callable_, context, args=args, kwargs=kwargs)</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> File "/home/kallithea/kallithea/venv/lib/python3.9/site-packages/mako/runtime.py", line 943, in _exec_template</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> callable_(context, *args, **kwargs)</span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> File "data_table__dt_elements_html", line 133, in render_last_change</span></div><div><br></div><div><br></div><div>Thanks</div><div>Jamie</div><div>_______________________________________________</div><div>kallithea-general mailing list</div><div><a href="mailto:kallithea-general@sfconservancy.org">kallithea-general@sfconservancy.org</a></div><div><a href="https://lists.sfconservancy.org/mailman/listinfo/kallithea-general">https://lists.sfconservancy.org/mailman/listinfo/kallithea-general</a></div><div><br></div></blockquote><div><br></div><div id="sig140779696"><table class="signature" style="font-size:small;font-family:Arial;" cellspacing="0" cellpadding="0"><tbody><tr><td><table class="table__StyledTable-sc-1avdl6r-0 kAbRZI" style="font-size:small;font-family:Arial;" cellspacing="0" cellpadding="0"><tbody><tr><td style="vertical-align:middle;" width="150"><span class="template3__ImageContainer-sc-vj949k-0 jeScQV" style="margin-right:20px;display:block;"><img src="https://nsquared.nz/img/nsquared-logo-big-no-text.png" class="image__StyledImage-sc-hupvqm-0 gYgOut" style="max-width:130px;" width="130"></span><br></td><td style="vertical-align:middle;"><h2 color="#000000" class="name__NameContainer-sc-1m457h3-0 jxbGUj" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:16px;color:#000000;font-weight:600;"><span>Jamie Love</span></h2><p color="#000000" class="job-title__Container-sc-1hmtp73-0 ifJNJc" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;color:#000000;font-size:12px;line-height:20px;"><span>N-Squared Software</span></p></td><td width="30"><div style="width:30px;"><br></div></td><td color="#C94112" class="color-divider__Divider-sc-1h38qjv-0 llIisW" style="width:1px;border-bottom-width:medium;border-bottom-style:none;border-bottom-color:currentcolor;border-left-width:1px;border-left-style:solid;border-left-color:rgb(201, 65, 18);" width="1"><br></td><td width="30"><div style="width:30px;"><br></div></td><td style="vertical-align:middle;"><table class="table__StyledTable-sc-1avdl6r-0 kAbRZI" style="font-size:small;font-family:Arial;" cellspacing="0" cellpadding="0"><tbody><tr style="vertical-align:middle;" height="25"><td style="vertical-align:middle;" width="30"><table class="table__StyledTable-sc-1avdl6r-0 kAbRZI" style="font-size:small;font-family:Arial;" cellspacing="0" cellpadding="0"><tbody><tr><td style="vertical-align:bottom;"><span color="#C94112" width="11" class="contact-info__IconWrapper-sc-mmkjr6-1 bglVXe" style="display:inline-block;background-color:rgb(201, 65, 18);"><img src="https://cdn2.hubspot.net/hubfs/53/tools/email-signature-generator/icons/phone-icon-2x.png" color="#C94112" alt="mobilePhone" class="contact-info__ContactLabelIcon-sc-mmkjr6-0 cnkwri" style="display:block;background-color:rgb(201, 65, 18);" width="13"></span><br></td></tr></tbody></table></td><td style="padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;color:#000000;"><a href="tel:+64 (27) 492 7866" color="#000000" class="contact-info__ExternalLink-sc-mmkjr6-2 ibLXSU" style="text-decoration-line:none;text-decoration-style:solid;text-decoration-color:currentcolor;text-decoration-thickness:auto;color:#000000;font-size:12px;"><span>+64 (21) 063 5462</span></a></td></tr><tr style="vertical-align:middle;" height="25"><td style="vertical-align:middle;" width="30"><table class="table__StyledTable-sc-1avdl6r-0 kAbRZI" style="font-size:small;font-family:Arial;" cellspacing="0" cellpadding="0"><tbody><tr><td style="vertical-align:bottom;"><span color="#C94112" width="11" class="contact-info__IconWrapper-sc-mmkjr6-1 bglVXe" style="display:inline-block;background-color:rgb(201, 65, 18);"><img src="https://cdn2.hubspot.net/hubfs/53/tools/email-signature-generator/icons/email-icon-2x.png" color="#C94112" alt="emailAddress" class="contact-info__ContactLabelIcon-sc-mmkjr6-0 cnkwri" style="display:block;background-color:rgb(201, 65, 18);" width="13"></span><br></td></tr></tbody></table></td><td style="padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;"><a href="mailto:jlove@nsquared.nz" color="#000000" class="contact-info__ExternalLink-sc-mmkjr6-2 ibLXSU" style="text-decoration-line:none;text-decoration-style:solid;text-decoration-color:currentcolor;text-decoration-thickness:auto;color:#000000;font-size:12px;"><span>jlove@nsquared.nz</span></a></td></tr><tr style="vertical-align:middle;" height="25"><td style="vertical-align:middle;" width="30"><table class="table__StyledTable-sc-1avdl6r-0 kAbRZI" style="font-size:small;font-family:Arial;" cellspacing="0" cellpadding="0"><tbody><tr><td style="vertical-align:bottom;"><span color="#C94112" width="11" class="contact-info__IconWrapper-sc-mmkjr6-1 bglVXe" style="display:inline-block;background-color:rgb(201, 65, 18);"><img src="https://cdn2.hubspot.net/hubfs/53/tools/email-signature-generator/icons/link-icon-2x.png" color="#C94112" alt="website" class="contact-info__ContactLabelIcon-sc-mmkjr6-0 cnkwri" style="display:block;background-color:rgb(201, 65, 18);" width="13"></span><br></td></tr></tbody></table></td><td style="padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;"><a href="https://nsquared.nz" color="#000000" class="contact-info__ExternalLink-sc-mmkjr6-2 ibLXSU" style="text-decoration-line:none;text-decoration-style:solid;text-decoration-color:currentcolor;text-decoration-thickness:auto;color:#000000;font-size:12px;"><span>nsquared.nz</span></a></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table><div class="signature"><br></div></div><div><br></div></body></html>