• $Query error when globals are mapped at the subscript level

    From Alan O'Neill@21:1/5 to All on Mon Nov 14 11:19:07 2022
    I believe there is a problem with the $q() function when globals are mapped in the global directory at the subscript level. Here's why.

    I have two databases, which I'll call database A (DB-A) and database B (DB-B). They each contain a set of VistA FileMan files stored in a global named ^WEB, and the structure of these files is the same in both databases. We needed DB-B to look to DB-A
    for all nodes in ^WEB except for ^WEB(3309,*) and ^WEB(3315,*). For these two, DB-B needed to have its own local copy, which resulted in the following [partial] global directory layout for DB-B.

    WEB WEB(3309) REG = DBA
    SEG = DBA
    FILE = /yottadb/dba/mumps.dat
    WEB(3309) WEB(3309)++ REG = DEFAULT
    SEG = DEFAULT
    FILE = /yottadb/dbb/mumps.dat
    WEB(3309)++ WEB(3315) REG = DBA
    SEG = DBA
    FILE = /yottadb/dba/mumps.dat
    WEB(3315) WEB(3315)++ REG = DEFAULT
    SEG = DEFAULT
    FILE = /yottadb/dbb/mumps.dat
    WEB(3315)++ WEBERROR REG = DBA
    SEG = DBA
    FILE = /yottadb/dba/mumps.dat

    Here is a partial listing of ^WEB(3315,*) from DB-A:

    DB-A>zwrite ^WEB(3315,*)
    ^WEB(3315,0)="Web System Profile^3315^19^18"
    ...snip...
    ^WEB(3315,"IP","pdd17.mycompany.edu",15)="" ^WEB(3315,"IP","wam.mycompany.edu",19)=""

    Here is a partial listing of ^WEB(3315,*) in DB-B:

    DB-B>zwrite ^WEB(3315,*)
    ^WEB(3315,0)="Web System Profile^3315^1^1"
    ...snip...
    ^WEB(3315,"IP","wam.mycompany.edu",1)=""

    Using $q() on this final node in DB-B should return null (or a node in ^WEB that has a first subscript that is greater than 3315). Instead, it is returning the next node in ^WEB(3315,*) from DB-A.

    DB-B>w $q(^WEB(3315,"IP","wam.mycompany.edu",1)) ^WEB(3315,"IP","wam.mycompany.edu",19)

    But that node does not exist in DB-B.

    DB-B>w ^WEB(3315,"IP","wam.mycompany.edu",19)
    %GTM-E-GVUNDEF, Global variable undefined: ^WEB(3315,"IP","wam.mycompany.edu",19)

    Put another way, I would never expect the following line of MUMPS code to fail under any circumstance, yet as you'll see, it does.

    DB-B>s g=$na(^WEB(3315)) f s g=$q(@g) q:g="" s x=@g
    %GTM-E-GVUNDEF, Global variable undefined: ^WEB(3315,"IP","wam.mycompany.edu",19)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Alan O'Neill@21:1/5 to All on Wed Nov 23 12:14:38 2022
    Just wondering if anyone has any thoughts.
    Happy Thanksgiving! :-)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Sam Habiel@21:1/5 to aonei...@gmail.com on Thu Nov 24 04:53:24 2022
    On Wednesday, November 23, 2022 at 3:14:39 PM UTC-5, aonei...@gmail.com wrote:
    Just wondering if anyone has any thoughts.
    Happy Thanksgiving! :-)

    Hello there.

    I take it you are using GT.M or YottaDB? It looks like a bug to me, but I think you have a possible workaround: remove the nodes from A, and leave them in B.

    When you have a moment, can you create a small self-standing example to illustrate the issue and post it to https://gitlab.com/YottaDB/DB/YDB/-/issues?

    --Sam Habiel at YottaDB

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From K.S. Bhaskar@21:1/5 to aonei...@gmail.com on Mon Nov 28 09:50:23 2022
    On Monday, November 14, 2022 at 2:19:09 PM UTC-5, aonei...@gmail.com wrote:
    I believe there is a problem with the $q() function when globals are mapped in the global directory at the subscript level. Here's why.

    I have two databases, which I'll call database A (DB-A) and database B (DB-B). They each contain a set of VistA FileMan files stored in a global named ^WEB, and the structure of these files is the same in both databases. We needed DB-B to look to DB-A
    for all nodes in ^WEB except for ^WEB(3309,*) and ^WEB(3315,*). For these two, DB-B needed to have its own local copy, which resulted in the following [partial] global directory layout for DB-B.

    WEB WEB(3309) REG = DBA
    SEG = DBA
    FILE = /yottadb/dba/mumps.dat
    WEB(3309) WEB(3309)++ REG = DEFAULT
    SEG = DEFAULT
    FILE = /yottadb/dbb/mumps.dat
    WEB(3309)++ WEB(3315) REG = DBA
    SEG = DBA
    FILE = /yottadb/dba/mumps.dat
    WEB(3315) WEB(3315)++ REG = DEFAULT
    SEG = DEFAULT
    FILE = /yottadb/dbb/mumps.dat
    WEB(3315)++ WEBERROR REG = DBA
    SEG = DBA
    FILE = /yottadb/dba/mumps.dat

    Here is a partial listing of ^WEB(3315,*) from DB-A:

    DB-A>zwrite ^WEB(3315,*)
    ^WEB(3315,0)="Web System Profile^3315^19^18"
    ...snip...
    ^WEB(3315,"IP","pdd17.mycompany.edu",15)="" ^WEB(3315,"IP","wam.mycompany.edu",19)=""

    Here is a partial listing of ^WEB(3315,*) in DB-B:

    DB-B>zwrite ^WEB(3315,*)
    ^WEB(3315,0)="Web System Profile^3315^1^1"
    ...snip...
    ^WEB(3315,"IP","wam.mycompany.edu",1)=""

    Using $q() on this final node in DB-B should return null (or a node in ^WEB that has a first subscript that is greater than 3315). Instead, it is returning the next node in ^WEB(3315,*) from DB-A.

    DB-B>w $q(^WEB(3315,"IP","wam.mycompany.edu",1)) ^WEB(3315,"IP","wam.mycompany.edu",19)

    But that node does not exist in DB-B.

    DB-B>w ^WEB(3315,"IP","wam.mycompany.edu",19)
    %GTM-E-GVUNDEF, Global variable undefined: ^WEB(3315,"IP","wam.mycompany.edu",19)

    Put another way, I would never expect the following line of MUMPS code to fail under any circumstance, yet as you'll see, it does.

    DB-B>s g=$na(^WEB(3315)) f s g=$q(@g) q:g="" s x=@g
    %GTM-E-GVUNDEF, Global variable undefined: ^WEB(3315,"IP","wam.mycompany.edu",19)

    You are using some advanced functionality in YottaDB, and likely using it in production. Contact your YottaDB support channel, if you have purchased support. If you have not purchased support, contact me (bhaskar at yottadb dot com) to purchase support,
    or if you want to explore free support, then post a standalone test case as Sam suggested.

    Regards
    – Bhaskar

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From K.S. Bhaskar@21:1/5 to K.S. Bhaskar on Wed Nov 30 08:03:36 2022
    On Monday, November 28, 2022 at 12:50:25 PM UTC-5, K.S. Bhaskar wrote:
    On Monday, November 14, 2022 at 2:19:09 PM UTC-5, aonei...@gmail.com wrote:
    I believe there is a problem with the $q() function when globals are mapped in the global directory at the subscript level. Here's why.

    I have two databases, which I'll call database A (DB-A) and database B (DB-B). They each contain a set of VistA FileMan files stored in a global named ^WEB, and the structure of these files is the same in both databases. We needed DB-B to look to DB-
    A for all nodes in ^WEB except for ^WEB(3309,*) and ^WEB(3315,*). For these two, DB-B needed to have its own local copy, which resulted in the following [partial] global directory layout for DB-B.

    WEB WEB(3309) REG = DBA
    SEG = DBA
    FILE = /yottadb/dba/mumps.dat
    WEB(3309) WEB(3309)++ REG = DEFAULT
    SEG = DEFAULT
    FILE = /yottadb/dbb/mumps.dat
    WEB(3309)++ WEB(3315) REG = DBA
    SEG = DBA
    FILE = /yottadb/dba/mumps.dat
    WEB(3315) WEB(3315)++ REG = DEFAULT
    SEG = DEFAULT
    FILE = /yottadb/dbb/mumps.dat
    WEB(3315)++ WEBERROR REG = DBA
    SEG = DBA
    FILE = /yottadb/dba/mumps.dat

    Here is a partial listing of ^WEB(3315,*) from DB-A:

    DB-A>zwrite ^WEB(3315,*)
    ^WEB(3315,0)="Web System Profile^3315^19^18"
    ...snip...
    ^WEB(3315,"IP","pdd17.mycompany.edu",15)="" ^WEB(3315,"IP","wam.mycompany.edu",19)=""

    Here is a partial listing of ^WEB(3315,*) in DB-B:

    DB-B>zwrite ^WEB(3315,*)
    ^WEB(3315,0)="Web System Profile^3315^1^1"
    ...snip...
    ^WEB(3315,"IP","wam.mycompany.edu",1)=""

    Using $q() on this final node in DB-B should return null (or a node in ^WEB that has a first subscript that is greater than 3315). Instead, it is returning the next node in ^WEB(3315,*) from DB-A.

    DB-B>w $q(^WEB(3315,"IP","wam.mycompany.edu",1)) ^WEB(3315,"IP","wam.mycompany.edu",19)

    But that node does not exist in DB-B.

    DB-B>w ^WEB(3315,"IP","wam.mycompany.edu",19)
    %GTM-E-GVUNDEF, Global variable undefined: ^WEB(3315,"IP","wam.mycompany.edu",19)

    Put another way, I would never expect the following line of MUMPS code to fail under any circumstance, yet as you'll see, it does.

    DB-B>s g=$na(^WEB(3315)) f s g=$q(@g) q:g="" s x=@g
    %GTM-E-GVUNDEF, Global variable undefined: ^WEB(3315,"IP","wam.mycompany.edu",19)
    You are using some advanced functionality in YottaDB, and likely using it in production. Contact your YottaDB support channel, if you have purchased support. If you have not purchased support, contact me (bhaskar at yottadb dot com) to purchase support,
    or if you want to explore free support, then post a standalone test case as Sam suggested.

    Regards
    – Bhaskar

    Thank you for contacting me off-list, and thank you for reporting this bug. We have created https://gitlab.com/YottaDB/DB/YDB/-/issues/960 ($QUERY(gvn) returns incorrect results when global names are mapped at the subscript level) to track it.

    Regards
    – Bhaskar

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)