anchor.diff:              end, 
               #ddColumn{type=Type, len=Len, prec=P} = imem_meta:meta_field_info(Name),
               Cmap1 = Cmap0#bind{tind=?MetaIdx, cind=Cindex, type=Type, len=Len, prec=P},
  -            column_map([], Columns, Tindex, Lookup, Meta1, [Cmap1|Acc]);                          
  +            column_map_columns(Columns, Lookup, Meta1, [Cmap1|Acc]);                          
           (Tcount==0) andalso (Schema==undefined) andalso (Table==undefined)->  
               ?ClientError({"Unknown column name", Name});
           (Tcount==0) andalso (Schema==undefined)->  
  
positive.code:                 , ptree=list_to_binary([Prefix, ".", atom_to_list(N)])
               } || {Ti, Ci, S, T, N, #ddColumn{type=Type, len=Len, prec=P}} <- Lookup, S==Schema, T==Table
              ],
      column_map([], Cmaps ++ Columns, Tindex, Lookup, Meta, Acc);
  column_map([], [#bind{schema=Schema, table=Table, name=Name}=Cmap0|Columns], Tindex, Lookup, Meta, Acc) ->
      % ?Debug("column_map 4 ~p~n", [Cmap0]),
      Pred = fun(L) ->
          (Name == element(5, L)) andalso
  
negative.code:             {Ti, Ci, S, T, Name, #ddColumn{type=Type, len=Len, prec=P, default=D}} = hd(Lmatch),
              R = (Ti /= ?MainIdx),   %% Only main table is editable
              Cmap1 = Cmap0#bind{schema=S, table=T, tind=Ti, cind=Ci, type=Type, len=Len, prec=P, default=D, readonly=R},
              column_map_columns(Columns, Lookup, Meta, [Cmap1|Acc])
      end;
  column_map_columns([{'fun',Fname,[Name]}=PTree|Columns], Lookup, Meta, Acc) ->
      % ?Debug("column_map 5 ~p~n", [PTree]),
      case imem_datatype:is_rowfun_extension(Fname,1) of
          true ->
              {S,T,N} = field_qname(Name),
              Alias = list_to_binary([Fname, "(", Name, ")"]),
              column_map_columns([#bind{schema=S, table=T, name=N, alias=Alias, func=binary_to_atom(Fname,utf8), ptree=PTree}|Columns], Lookup, Meta, Acc);
          false ->
              ?UnimplementedException({"Unimplemented row function",{Fname,1}})
      end;        
  column_map_columns([{as, {'fun',Fname,[Name]}, Alias}=PTree|Columns], Lookup, Meta, Acc) ->
      % ?Debug("column_map 6 ~p~n", [PTree]),
      case imem_datatype:is_rowfun_extension(Fname,1) of
          true ->
              {S,T,N} = field_qname(Name),
              column_map_columns([#bind{schema=S, table=T, name=N, func=binary_to_atom(Fname,utf8), alias=Alias, ptree=PTree}|Columns], Lookup, Meta, Acc);
          false ->
              ?UnimplementedException({"Unimplemented row function",{Fname,1}})
      end;                    
  column_map_columns([{as, Name, Alias}=PTree|Columns], Lookup, Meta, Acc) ->
      % ?Debug("column_map 7 ~p~n", [PTree]),
      {S,T,N} = field_qname(Name),
      column_map_columns([#bind{schema=S, table=T, name=N, alias=Alias, ptree=PTree}|Columns], Lookup, Meta, Acc);
  column_map_columns([Name|Columns], Lookup, Meta, Acc) when is_binary(Name)->
      % ?Debug("column_map 8 ~p~n", [Name]),
      {S,T,N} = field_qname(Name),
      column_map_columns([#bind{schema=S, table=T, name=N, alias=Name, ptree=Name}|Columns], Lookup, Meta, Acc);
  column_map_columns([Expression|_], _Lookup, _Meta, _Acc)->
      % ?Debug("column_map 9 ~p~n", [Expression]),
      ?UnimplementedException({"Expressions not supported", Expression});
  column_map_columns([], _Lookup, _Meta, Acc) ->
      lists:reverse(Acc);
  column_map_columns(Columns, Lookup, Meta, Acc) ->
      ?Warn("column_map_columns error Columns ~p~n", [Columns]),
      ?Warn("column_map_columns error Lookup ~p~n", [Lookup]),
      ?Warn("column_map_columns error Meta ~p~n", [Meta]),
      ?Warn("column_map_columns error Acc ~p~n", [Acc]),
      ?ClientError({"Column map invalid columns",Columns}).
  
  
  index_of(Item, List) -> index_of(Item, List, 1).
  