| Last change
 on this file since 926 was             599, checked in by Kris Deugau, 12 years ago | 
        
          | 
/trunk
 
Prepare for changes to allow any record in either forward or reversezones, no matter how silly.
 
 
This commit adds a database function to catch errors with CASTing acolumn 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 | 
      
      
| Rev | Line |  | 
|---|
| [599] | 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 | 
|---|
|  | 4 | CREATE 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 | 
|---|
|  | 10 | CREATE OR REPLACE FUNCTION inetlazy (rdata text) RETURNS inet AS $$ | 
|---|
|  | 11 | BEGIN | 
|---|
|  | 12 | RETURN CAST(rdata AS inet); | 
|---|
|  | 13 | EXCEPTION | 
|---|
|  | 14 | WHEN OTHERS THEN | 
|---|
|  | 15 | RETURN CAST('0.0.0.0/0' AS inet); | 
|---|
|  | 16 | END; | 
|---|
|  | 17 | $$ LANGUAGE plpgsql; | 
|---|
|  | 18 |  | 
|---|
|  | 19 | -- Update dbversion | 
|---|
|  | 20 | UPDATE misc SET value='1.2.4' WHERE key='dbversion'; | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.