wal2json icon indicating copy to clipboard operation
wal2json copied to clipboard

Add Support for Key Value Hash

Open nHurD opened this issue 7 years ago • 0 comments

This will add support for outputting change data in a key value hash rather than a series of arrays (see #71) and is enabled by setting the use-key-value-hash to 1.

Once enabled, the changes will be outputted as follows:

 {                                                                   
         "change": [                                                 
                 {                                                   
                         "kind": "insert",                           
                         "schema": "public",                         
                         "table": "table_with_pk",                   
                         "changes": {                                
                                 "a": 2,                             
                                 "b": 1,                             
                                 "c": 2,                             
                                 "d": 3,                             
                                 "e": 3.540,                         
                                 "f": 876.563,                       
                                 "g": 1.23,                          
                                 "h": "teste     ",                  
                                 "i": "testando",                    
                                 "j": "um texto longo",              
                                 "k": "001110010101010",             
                                 "l": "Sat Nov 02 17:30:52 2013",    
                                 "m": "02-04-2013",                  
                                 "n": true,                          
                                 "o": "{ \"a\": 123 }",              
                                 "p": "'Old' 'Parr'"                 
                         },                                          
                         "columntypes": {                            
                                 "a": "smallint",                    
                                 "b": "smallint",                    
                                 "c": "integer",                     
                                 "d": "bigint",                      
                                 "e": "numeric(5,3)",                
                                 "f": "real",                        
                                 "g": "double precision",            
                                 "h": "character(10)",               
                                 "i": "character varying(30)",       
                                 "j": "text",                        
                                 "k": "bit varying(20)",             
                                 "l": "timestamp without time zone", 
                                 "m": "date",                        
                                 "n": "boolean",                     
                                 "o": "json",                        
                                 "p": "tsvector"                     
                         }                                           
                 }          
         ]                                                           
 }                                 

nHurD avatar Feb 13 '19 20:02 nHurD