cancel
Showing results for 
Search instead for 
Did you mean: 

Changing column type fails

smdesai
New Contributor II

Hello, I have a table that's loaded by some data from an odbc call and the structure is as follows: 

 

q)meta res
c         | t f a
----------| -----
id        | C
first_name| C
last_name | C
email     | C

 


Updating the column type for "id" to a symbol using the following fails.

 

q)update "S"$id from res
'id
  [0]  update "S"$id from res

 


Any reason as to why? This is on arm64 (Apple Silicon) where I've built odbc.so from the kdb github project. The same code however works on on m64 (Apple Intel), but this uses the stock odbc.so that's provided by the above mentioned kdb project. 

3 REPLIES 3

gyorokpeter-kx
New Contributor III
New Contributor III

Can you make sure that the res variable you do the meta on is the same that you are trying to update? E.g. global vs local variable, or other queries changing it in the meantime. Or there being a space in the column name (possible if parsing from CSV).

This works:

q)res:([]id:("AA";"BB");first_name:("CC";"DD");last_name:("EE";"FF");email:("GG";"HH"))
q)meta res
c         | t f a
----------| -----
id        | C
first_name| C
last_name | C
email     | C
q)update "S"$id from res
id first_name last_name email
-----------------------------
AA "CC"       "EE"      "GG"
BB "DD"       "FF"      "HH"

It's the same variable and the problem seems to be much worse in that I can't even do the following: 

q)select id from res
'id
  [0]  select id from res

 It looks as if something is screwed up doing the following odbc query:

\l odbc.k
h:.odbc.open `db
userq:"select id,first_name,last_name,email from user"
res:.odbc.eval[h;userq]
.odbc.close h

smdesai
New Contributor II

Well, I found the root cause of the issue, it's the way I built odbc.so for Apple Silicon. I've rebuilt it and everything works as expected.