Bug 3670 - COPY BINARY INTO support for inet type
Summary: COPY BINARY INTO support for inet type
Status: NEW
Alias: None
Product: SQL
Classification: Unclassified
Component: all (show other bugs)
Version: -- development
Hardware: All All
: Normal enhancement
Assignee: SQL devs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-09 08:43 CET by Asif Khan Suri
Modified: 2016-04-11 11:45 CEST (History)
0 users



Attachments
inet data to do binary load (80 bytes, application/octet-stream)
2015-02-09 08:46 CET, Asif Khan Suri
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Asif Khan Suri 2015-02-09 08:43:42 CET
User-Agent:       Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:38.0) Gecko/20100101 Firefox/38.0
Build Identifier: 

minor change in sql.c to allow binary load inet type. I am not part of dev group but tried following to get it work. binary load is working after change.
Add new function
int wrap_inet_type(int localtype)
{
  static int type_inet = 0;
  if( type_inet == 0 || type_inet == TYPE_any) type_inet = ATOMindex("inet"); 
  if( localtype > TYPE_str && localtype == type_inet && type_inet < TYPE_any )
    return TYPE_lng;
  return localtype;
}
and replace  
int tpe = col->type.type->localtype;  
with
int tpe = wrap_inet_type(col->type.type->localtype);
in function mvc_bin_import_table_wrap



Reproducible: Always

Steps to Reproduce:
1.create table inetip (ip inet);
2.COPY BINARY INTO inetip FROM ( '/root/MonetDB/ip.bat' );
3.
Actual Results:  
failed to attach file /root/MonetDB/ip.bat

Expected Results:  
#create table inetip (ip inet);
#COPY BINARY INTO inetip FROM ( '/root/MonetDB/ip.bat' );
[ 10    ]
#select * from inetip;
% sys.inetip # table_name
% ip # name
% inet # type
% 0 # length
[ 192.168.100.50        ]
[ 193.168.100.51        ]
[ 193.168.100.52/24     ]
[ 162.168.100.50        ]
[ 163.168.100.51/24     ]
[ 163.168.100.52        ]
[ 162.168.100.50        ]
[ 163.168.100.52        ]
[ NULL  ]
[ 163.168.100.52        ]
#drop table inetip;
Comment 1 Asif Khan Suri 2015-02-09 08:46:14 CET
Created attachment 318 [details]
inet data to do binary load