Search code examples
kdb

views[] (\b) behavior in current and specified namespace in kdb


Difference in output of \b is different in current namespace and specified namespace.
When I have below table, view and query in current and another namespace.
\a works perfectly for both namespaces but same is not the case with \b.

q)t:([] a:1 2)
q).ns1.t:([] a:1 2)
q)q:select max a from t
q)v:: select max a from t
q).ns1.q: select max a from .ns1.t
q).ns1.v:: select max a from .ns1.t
q)\a
`q`t
q)\b / clearly displaying view in current namespace
,`v
q)\a .ns1
`q`t
q)\b .ns1 / not displaying the view
`symbol$()
q)\a .ns1
`q`t`v / view is displayed in the output of \a

How can we determine the table and view from the output of \a .ns1?
Am I missing something? Is there a way to get the views of the specified namespace?


Solution

  • The thing is that: Views and their dependencies can be defined only in the default namespace. See Kx Wiki for reference.

    So, technically, even though .ns1.v is defined with :: as a view, it is not a view, but usual table.