<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Postgresql on Caktus Group</title><link>https://www.caktusgroup.com/tags/postgresql/</link><description>Recent content in Postgresql on Caktus Group</description><generator>Hugo</generator><language>en</language><lastBuildDate>Mon, 16 Jun 2025 19:00:00 +0000</lastBuildDate><atom:link href="https://www.caktusgroup.com/tags/postgresql/index.xml" rel="self" type="application/rss+xml"/><item><title>Avoiding Timezone Traps: Correctly Extracting Date/Time Subfields in Django with PostgreSQL</title><link>https://www.caktusgroup.com/blog/2025/06/16/avoiding-timezone-traps-correctly-extracting-datetime-subfields-django-postgresql/</link><pubDate>Mon, 16 Jun 2025 19:00:00 +0000</pubDate><guid>https://www.caktusgroup.com/blog/2025/06/16/avoiding-timezone-traps-correctly-extracting-datetime-subfields-django-postgresql/</guid><description>&lt;p>Working with timezones can sometimes lead to confusing results,
especially when combining Django's ORM, raw SQL for performance (like
in PostgreSQL materialized views), and specific timezone requirements. I
recently had an issue while aggregating traffic stop data by year, where
all yearly calculations needed to reflect the 'America/New_York'
(EST/EDT) timezone, even though our original data contained
&lt;code>timestamp with time zone&lt;/code> fields. We were using
&lt;a href="https://github.com/xelixdev/django-pgviews-redux" target="_blank" rel="noopener noreferrer">django-pgviews-redux&lt;/a>
to manage materialized views, and I mistakenly attempted to apply
timezone logic to a &lt;code>date&lt;/code> field that had no time or timezone
information.&lt;/p></description></item><item><title>Tips for Tracking Django Model Changes with django-pghistory</title><link>https://www.caktusgroup.com/blog/2025/04/07/tips-tracking-django-model-changes-django-pghistory/</link><pubDate>Mon, 07 Apr 2025 10:00:00 +0000</pubDate><guid>https://www.caktusgroup.com/blog/2025/04/07/tips-tracking-django-model-changes-django-pghistory/</guid><description>&lt;p>Django and its admin interface are a big part of &lt;a href="https://www.caktusgroup.com/blog/2016/12/14/django-boring-or-why-tech-startups-should-use-django/">why Caktus uses
Django&lt;/a>,
but the admin's ability to log database changes is limited. For
example, it shows only changes made via the Django admin, not via other
parts of the site.&lt;/p></description></item><item><title>How to Use regexp_matches and regexp_match in PostgreSQL</title><link>https://www.caktusgroup.com/blog/2025/03/19/how-use-regexp_matches-and-regexp_match-postgresql/</link><pubDate>Wed, 19 Mar 2025 08:00:00 +0000</pubDate><guid>https://www.caktusgroup.com/blog/2025/03/19/how-use-regexp_matches-and-regexp_match-postgresql/</guid><description>&lt;h2 id="introduction">Introduction&lt;/h2>
&lt;p>&lt;code>regexp_matches()&lt;/code> and &lt;code>regexp_match()&lt;/code> are two similar &lt;a href="https://www.postgresql.org/docs/current/functions-string.html" target="_blank" rel="noopener noreferrer">string
functions&lt;/a>
that support regular expression matching directly in the PostgreSQL
database. &lt;code>regexp_matches()&lt;/code> was added in &lt;a href="https://www.postgresql.org/docs/8.3/release-8-3.html" target="_blank" rel="noopener noreferrer">PostgreSQL
8.3&lt;/a>, and
&lt;code>regexp_match()&lt;/code> was added in &lt;a href="https://www.postgresql.org/docs/release/10.0/" target="_blank" rel="noopener noreferrer">PostgreSQL
10&lt;/a> (keep reading to see
how ChatGPT struggled to answer this question).&lt;/p></description></item><item><title>Getting Started with Dagster</title><link>https://www.caktusgroup.com/blog/2024/12/09/getting-started-dagster/</link><pubDate>Mon, 09 Dec 2024 23:00:00 +0000</pubDate><guid>https://www.caktusgroup.com/blog/2024/12/09/getting-started-dagster/</guid><description>&lt;p>Recently, Caktus has been using Tailscale to manage VPN connections
between Android tablets and a central server. We wanted to report on the
devices connected to the network using the Tailscale API. While we could
use tools like &lt;a href="https://docs.celeryq.dev/en/stable/" target="_blank" rel="noopener noreferrer">Celery&lt;/a> to fetch
data from the API and load it into a database&amp;mdash;given its widespread use
in the Django ecosystem&amp;mdash;we also wanted to explore other options.&lt;/p></description></item><item><title>How to Use Kubernetes on Azure for Cloud Computing</title><link>https://www.caktusgroup.com/blog/2020/04/28/how-use-kubernetes-azure-cloud-computing/</link><pubDate>Tue, 28 Apr 2020 18:41:03 +0000</pubDate><guid>https://www.caktusgroup.com/blog/2020/04/28/how-use-kubernetes-azure-cloud-computing/</guid><description>&lt;p>For the &lt;a href="http://ratom.web.unc.edu/" target="_blank" rel="noopener noreferrer">Review, Appraisal, and Triage of Mail (RATOM)
project&lt;/a>, funded by the Andrew W. Mellon
Foundation, we were tasked with deploying to a Microsoft Azure
environment. More details about the project are in our &lt;a href="https://www.caktusgroup.com/blog/2020/03/19/email-extract-data-microsoft-pst-files/">first blog
post&lt;/a>
in this Learn With Us blog series. Caktus has experience with Amazon Web
Services (AWS) and Google Cloud, but we hadn't had the opportunity to
use Azure yet, so we looked forward to the opportunity to use that
environment and document our experience. The entire deployment process
is available on GitHub as a reference under the
&lt;a href="https://github.com/StateArchivesOfNorthCarolina/ratom-deploy" target="_blank" rel="noopener noreferrer">StateArchivesOfNorthCarolina/ratom-deploy&lt;/a>
repository.&lt;/p></description></item><item><title>Postgres Present and Future (PyCon 2016 Must-See Talk: 6/6)</title><link>https://www.caktusgroup.com/blog/2016/08/18/postgres-present-and-future-pycon-2016-must-see-talk-66/</link><pubDate>Thu, 18 Aug 2016 12:00:00 +0000</pubDate><guid>https://www.caktusgroup.com/blog/2016/08/18/postgres-present-and-future-pycon-2016-must-see-talk-66/</guid><description>&lt;p>&lt;em>Part six of six in our annual &lt;a href="https://www.caktusgroup.com/blog/tags/PyCon%20Must%20See%20Series/">PyCon Must-See Series&lt;/a>, a weekly highlight of talks our staff especially loved at PyCon. With so many fantastic talks, it’s hard to know where to start, so here’s our short list.&lt;/em>&lt;/p></description></item><item><title>Query Expressions are Amazing</title><link>https://www.caktusgroup.com/blog/2016/06/20/query-expressions-are-amazing/</link><pubDate>Mon, 20 Jun 2016 11:30:00 +0000</pubDate><guid>https://www.caktusgroup.com/blog/2016/06/20/query-expressions-are-amazing/</guid><description>&lt;p>The Django 1.8 release added support for complex query expressions. The
&lt;a href="https://docs.djangoproject.com/en/1.8/ref/models/expressions/" target="_blank" rel="noopener noreferrer">documentation&lt;/a>
has some nice examples but they don't do justice to how crazy awesome
these are. In this post, we will go through some additional examples of
how to leverage these expressions.&lt;/p></description></item><item><title>OpenBlock Geocoder, Part 1: Data Model and Geocoding</title><link>https://www.caktusgroup.com/blog/2011/12/12/openblock-geocoder-part-1-data-model-and-geocoding/</link><pubDate>Mon, 12 Dec 2011 16:17:20 +0000</pubDate><guid>https://www.caktusgroup.com/blog/2011/12/12/openblock-geocoder-part-1-data-model-and-geocoding/</guid><description>&lt;p>As Tobias mentioned in &lt;a href="http://www.caktusgroup.com/blog/2011/12/06/scraping-data-and-web-standards/">Scraping Data and Web Standards&lt;/a>, Caktus is collaborating with the UNC School of Journalism to help develop Open Rural (the code is on &lt;a href="https://github.com/openrural">GitHub&lt;/a>). Open Rural hopes to help rural newspapers in North Carolina leverage &lt;a href="http://openblockproject.org/">OpenBlock&lt;/a>. This blog post is the first of several covering the internals of OpenBlock and, specifically, the geocoder.&lt;/p></description></item><item><title>Basic Django deployment with virtualenv, fabric, pip and rsync</title><link>https://www.caktusgroup.com/blog/2010/04/22/basic-django-deployment-with-virtualenv-fabric-pip-and-rsync/</link><pubDate>Fri, 23 Apr 2010 00:46:37 +0000</pubDate><guid>https://www.caktusgroup.com/blog/2010/04/22/basic-django-deployment-with-virtualenv-fabric-pip-and-rsync/</guid><description>&lt;p>Deployment is usually a tedious process with lots of tinkering until
everything is setup just right. We deploy quite a few Django sites on a
regular basis here at Caktus and still do tinkering, but we've
attempted to functionalize some of the core tasks to ease the process.
I've put together a basic example that outlines local and remote
environment setup. This is a simplified example and just one of many
ways to deploy a Django project (I learned a lot from Jacob
Kaplan-Moss'
&lt;a href="http://github.com/jacobian/django-deployment-workshop/" target="_blank" rel="noopener noreferrer">django-deployment-workshop&lt;/a>),
so I encourage you to browse around the Django community to learn more.
The entire source for this example project can be found in the
&lt;a href="http://www.bitbucket.org/copelco/caktus-deployment/src/tip/example-django-project/" target="_blank" rel="noopener noreferrer">caktus-deployment Bitbucket
repository&lt;/a>.&lt;/p></description></item><item><title>Setting PostgreSQL's SHMMAX in Mac OS X 10.5 (Leopard)</title><link>https://www.caktusgroup.com/blog/2009/08/13/setting-postgresqls-shmmax-in-mac-os-x-105-leopard/</link><pubDate>Thu, 13 Aug 2009 11:46:08 +0000</pubDate><guid>https://www.caktusgroup.com/blog/2009/08/13/setting-postgresqls-shmmax-in-mac-os-x-105-leopard/</guid><description>&lt;p>If you've ever tried to increase the
&lt;a href="http://www.postgresql.org/docs/current/static/runtime-config-resource.html#GUC-SHARED-BUFFERS" target="_blank" rel="noopener noreferrer">shared_buffers&lt;/a>
setting in your postgresql.conf to a value that exceeds the amount of
shared memory supported by your operating system kernel, then you'll
see an error message like this:&lt;/p></description></item><item><title>Explicit Table Locking with PostgreSQL and Django</title><link>https://www.caktusgroup.com/blog/2009/05/26/explicit-table-locking-with-postgresql-and-django/</link><pubDate>Tue, 26 May 2009 18:59:10 +0000</pubDate><guid>https://www.caktusgroup.com/blog/2009/05/26/explicit-table-locking-with-postgresql-and-django/</guid><description>&lt;p>By default, &lt;a href="http://www.djangoproject.com/" target="_blank" rel="noopener noreferrer">Django&lt;/a> doesn't do explicit
table locking. This is OK for most read-heavy scenarios, but sometimes
you need guaranteed, exclusive access to the data. Caktus uses
&lt;a href="http://www.postgresql.org/" target="_blank" rel="noopener noreferrer">PostgreSQL&lt;/a> in most of our production
environments, so we can use the &lt;a href="http://www.postgresql.org/docs/8.3/interactive/explicit-locking.html" target="_blank" rel="noopener noreferrer">various lock
modes&lt;/a>
it provides to control concurrent access to the data. Once we obtain a
lock in PostgreSQL, it is held for the remainder of the current
transaction. Django provides transaction management, so all we need to
do is execute a &lt;a href="http://www.postgresql.org/docs/8.3/interactive/sql-lock.html" target="_blank" rel="noopener noreferrer">SQL LOCK
statement&lt;/a>
within a transaction, and Django and PostgreSQL will handle the rest.&lt;/p></description></item><item><title>Why Caktus Uses Django</title><link>https://www.caktusgroup.com/blog/2009/01/13/why-caktus-uses-django/</link><pubDate>Tue, 13 Jan 2009 15:45:31 +0000</pubDate><guid>https://www.caktusgroup.com/blog/2009/01/13/why-caktus-uses-django/</guid><description>&lt;p>Here at &lt;a href="http://www.caktusgroup.com/services/" target="_blank" rel="noopener noreferrer">Caktus&lt;/a>, we use the
popular &lt;a href="http://www.djangoproject.com" target="_blank" rel="noopener noreferrer">Django&lt;/a> web framework for a lot
of our custom web application development. We don't use Django simply
because it's popular, easy to learn, or happened to be the first thing
we found. We've written web apps in PHP, Java, and Ruby on Rails--all
before we discovered Django--but were never quite satisfied. Following
are just a few of the reasons that we both enjoy working with Django and
believe it gives you (the client) the best end-product.&lt;/p></description></item><item><title>minibooks: Small Business Bookkeeping</title><link>https://www.caktusgroup.com/blog/2009/01/07/minibooks-small-business-bookkeeping/</link><pubDate>Wed, 07 Jan 2009 15:49:06 +0000</pubDate><guid>https://www.caktusgroup.com/blog/2009/01/07/minibooks-small-business-bookkeeping/</guid><description>&lt;p>Caktus released minibooks (open-sourced under the AGPL) as a bookkeeping
package for small tech agencies. Boasting a &lt;a href="http://en.wikipedia.org/wiki/Double-entry_bookkeeping_system" target="_blank" rel="noopener noreferrer">double-entry
accounting&lt;/a>
system, &lt;a href="http://en.wikipedia.org/wiki/Customer_relationship_management" target="_blank" rel="noopener noreferrer">customer relationship management
(CRM)&lt;/a>
and transaction reconciliation, minibooks provides a clean, multiuser
web-based interface to manage simple accounting needs for small
businesses.&lt;/p></description></item><item><title>Asterisk CDR &amp; Django integration with ODBC</title><link>https://www.caktusgroup.com/blog/2008/10/13/asterisk-cdr-django-odbc/</link><pubDate>Mon, 13 Oct 2008 14:58:09 +0000</pubDate><guid>https://www.caktusgroup.com/blog/2008/10/13/asterisk-cdr-django-odbc/</guid><description>&lt;p>Tobias already
&lt;a href="http://www.caktusgroup.com/blog/2007/12/15/is-asterisk-more-silent-than-youd-like/" target="_blank" rel="noopener noreferrer">mentioned&lt;/a>
how Caktus uses &lt;a href="http://www.asterisk.org/" target="_blank" rel="noopener noreferrer">Asterisk&lt;/a> as our PBX. He also
mentioned how we tested various frontends both for managing the asterisk
configuration and interacting with asterisk to, for example, check our
voicemail. We were inticed by some of the client management solutions
that we could plumb up with asterisk. Caktus has a loose administration
structure, which allows us to be flexible and not have levels of
managers between clients and coders. But, this flexiblility can leave
loose ends unchecked when the person in charge of a project is
distracted for a day or two. We saw this as an opportunity where Caktus
could add a level of group accountability and use some neat technology.
We also wanted a tool that would integrate well with our current
homegrown &lt;a href="http://www.djangoproject.com" target="_blank" rel="noopener noreferrer">Django&lt;/a>ERP/CRM as well as Trac,
our prefered tool for project management. So, we decided to write some
sweet code.&lt;/p></description></item><item><title>Database Explained for the Business Professional</title><link>https://www.caktusgroup.com/blog/2008/02/22/database-explained-for-the-business-professional/</link><pubDate>Fri, 22 Feb 2008 08:23:58 +0000</pubDate><guid>https://www.caktusgroup.com/blog/2008/02/22/database-explained-for-the-business-professional/</guid><description>&lt;p>One problem with marketing is that it introduces pseudo-false concepts,
arbitrarily divorces necessarily wed ones, and leaves out all the gory
details. We recently had a client ask us,&lt;/p></description></item></channel></rss>