Software |
DMX4Linux Driver Suite for Linux |
csv2iif.pl suite convert PayPal transactions to IIF, OFX, QIF |
Hardware |
DMX30 Interface 128Ch SPP |
DMX43 Interface 2out 2in EPP |
LED Hardware for Linux and Windows |
EPROM Sampler for 8 bits of sound |
Misc |
CatWeasel Linux drivers for MK3/4 PCI |
pg_trompe PostgreSQL replication |
trycatch C exception/signal handling lib |
Patches to various software |
Tools and small scripts |
Docs misc documents |
Links to lighting stuff |
Message Digest Aggregate Functions for PostgreSQLThis library provides message digest aggregate function for PostgreSQL which complement the built in MD5 function and the other message digests from the pgcrypto contrib module. You can use these aggregate functions to calculate a message digest for a column over multiple rows. This can be used to effectively compare two tables with just a single equality test for (each column). See the example below.LicenseNew and simplified BSD license Releases
ContactFor questions and suggestions contact Dirk Jagdmann <doj@cubic.org>. Functions
ExampleWe create two tables which are nearly identical:
Comparing the i columns will evaluate to the same digest: # SELECT md5agg(i) FROM (SELECT i::text FROM md5agg_a ORDER BY i) AS tab; md5agg ---------------------------------- 781e5e245d69b566979b86e28d23f2c7 (1 row) # SELECT md5agg(i) FROM (SELECT i::text FROM md5agg_b ORDER BY i) AS tab; md5agg ---------------------------------- 781e5e245d69b566979b86e28d23f2c7 (1 row)Note that calculating the message digest only makes sense, if the column values are fed into the aggregate function in a specific order. The SQL language makes it necessary to write this table expression to use the aggregate function. If we now compare the text column we see an obvious difference in
the calculated digest: # SELECT md5agg(t) FROM (SELECT t FROM md5agg_a ORDER BY i) AS tab; md5agg ---------------------------------- a925576942e94b2ef57a066101b48876 (1 row) # SELECT md5agg(t) FROM (SELECT t FROM md5agg_b ORDER BY i) AS tab; md5agg ---------------------------------- 6884d0022fd5202573f69d6e2a7fa375 (1 row)We can even combine both calculations into a single equality comparision: # SELECT (SELECT md5agg(t) FROM (SELECT t FROM md5agg_a ORDER BY i) AS tab) = (SELECT md5agg(t) FROM (SELECT t FROM md5agg_b ORDER BY i) AS tab) as "compare col t must be FALSE"; compare col t must be FALSE ----------------------------- f (1 row) TODO
|