#sql
- My First C: A GTIN Data Type for PostgreSQL
https://justatheory.com/2006/09/postgres-gtin-0.01/
- Thoughts on Testing SQL Result Sets
https://justatheory.com/2009/06/pgtap-comparing-relations/
pgTAP: The Critique I’ve been continuing hacking on pgTAP in order to add a lot more schema-testing functionality and a few other niceties. But back when I started the project, I using it to write tests for CITEXT, which was great for my sanity as I developed it, but proved a bit controversial. In a pgsql-hackers post, Tom Lane wrote:
- Dynamic OFFSETs and LIMITs
https://justatheory.com/2009/01/postgres-dynamic-limit/
- VCS-Enabled SQL Change Management
https://justatheory.com/2012/01/vcs-sql-change-management/
Some thoughts on how to use VCS history to determine what changes need to be deployed or reverted without relying on a configuration file.
- How to Generate Recurring Events in the Database
https://justatheory.com/2008/01/postgres-recurring-events/
Going deep on using Postgres functions to create efficient recurring events.
- Enforce Foreign Key Integrity in SQLite with Triggers
https://justatheory.com/2004/11/sqlite-foreign-key-triggers/
After some some Googling and experimentation, I’ve figured out how to enforce foreign key constraints in SQLite. I got most of the code from Cody Pisto’s sqlite_fk utility. I couldn’t get it to work, but the essential code for the triggers was in its fk.c file, so I just borrowed from that (public domain) code to figure it out.
- Sqitch Update: All Your Rebase Are...Never Mind
https://justatheory.com/2012/12/sqitch-rebase/
- Enforcing a Set of Values
https://justatheory.com/2010/01/enforce-set-of-postgres-values/
- Unicode Normalization in SQL
https://justatheory.com/2009/09/postgres-unicode-normalization/
- My Catalyst Tutorial: Add Authors to the View
https://justatheory.com/2009/11/sql-view-aggregate-magic/
- Sqitch — VCS-powered SQL Change Management
https://justatheory.com/2012/04/sqitch-draft/
Back in January, I wrote three posts outlining some ideas I had about a straight-forward, sane way of managing SQL change management. The idea revolved around specifying scripts to deploy and revert in a plan file, and generating that plan file from VCS history. I still feel pretty good about the ideas there, and work has agreed to let me write it and open-source it. Here is the first step making it happen. I call it “Sqitch.”
- SQL Change Management Sans Duplication
https://justatheory.com/2012/01/sql-change-management-sans-redundancy/
Here’s how I propose to eliminate the duplication of code between deploy and revert SQL change management scripts.
- Committed: pgTAP Result Set Assertion Functions
https://justatheory.com/2009/07/pgtap-results-eq/
Regular readers will know that I’ve been thinking a lot about testing SQL result sets and how to how to name result testing functions, and various implementation issues. I am very happy to say that I’ve now committed the first three such test functions to the Git repository. They’ve been tested on 8.4 and 8.3. Here’s what I came up with.
- Multirow Database Updates
https://justatheory.com/2013/09/multirow-database-updates/
- Sqitch Update: Almost Usable
https://justatheory.com/2012/07/sqitch-almost-usable/
- Sqitch: Back to the VCS
https://justatheory.com/2012/06/sqitch-vcs-again/
- Managing Key/Value Pairs in PostgreSQL
https://justatheory.com/2010/08/postgres-key-value-pairs/
Let’s say that you’ve been following the latest research in key/value data storage and are interested in managing such data in a PostgreSQL database. You want to have functions to store and retrieve pairs, but there is no natural way to represent pairs in SQL. Many languages have hashes or or data dictionaries to fulfill this role, and you can pass them to functional interfaces. SQL’s got nothin’. In PostgreSQL, have two options: use nested arrays (simple, fast) or use a custom composite data type (sugary, legible).
- Sqitch: Depend On It!
https://justatheory.com/2012/08/sqitch-depend-on-it/
- MySQL's REPLACE Considered Harmful
https://justatheory.com/2005/03/mysql-replace-considered-harmful/
- Sqitch Symbolism
https://justatheory.com/2012/09/sqitch-symbolism/
- Simple SQL Change Management
https://justatheory.com/2012/01/simple-sql-change-management/
I’ve been thinking a lot about SQL change management. I think I may finally have cracked this thing wide open.
Follow #sql
on RSS or use the
JSON API
curl -X GET \
-H "Content-type: application/json" \
-H "Accept: application/json" \
"https://octothorp.es/~/sql"