source: trunk/dns-1.2.3-1.2.4.sql@ 818

Last change on this file since 818 was 599, checked in by Kris Deugau, 11 years ago

/trunk

Prepare for changes to allow any record in either forward or reverse
zones, no matter how silly.

This commit adds a database function to catch errors with CASTing a
column as inet, so that any place we need to sort records based on the
IP value of a column succeeds by treating non-IP values as 0.0.0.0/0.

File size: 649 bytes
Line 
1-- SQL upgrade file for dnsadmin 1.2.3 to 1.2.4 bugfix update
2
3-- pre-pg8.3, this must be run as a superuser
4CREATE LANGUAGE plpgsql;
5-- it's required for:
6
7-- Return proper conversion of string to inet, or 0.0.0.0/0 if the string is
8-- not a valid inet value. We need to do this to support "funky" records that
9-- may not actually have valid IP address values. Used for ORDER BY
10CREATE OR REPLACE FUNCTION inetlazy (rdata text) RETURNS inet AS $$
11BEGIN
12 RETURN CAST(rdata AS inet);
13EXCEPTION
14 WHEN OTHERS THEN
15 RETURN CAST('0.0.0.0/0' AS inet);
16END;
17$$ LANGUAGE plpgsql;
18
19-- Update dbversion
20UPDATE misc SET value='1.2.4' WHERE key='dbversion';
Note: See TracBrowser for help on using the repository browser.