Results 1 to 8 of 8

Thread: INSERT SELECT statement "Internal error - sql_select_into_memvar()"

  1. #1
    Junior Member
    Join Date
    Jul 2015
    Posts
    25

    INSERT SELECT statement "Internal error - sql_select_into_memvar()"

    Hi all, I hope this is the correct subforum.

    I'm trying to copy the contents of one database into another. I am using javascript,the exact code is:

    Code:
    Lianja.execute("INSERT INTO table1 SELECT * FROM table2
    Table2 has been created by invoking the "COPY STRUCTURE" command on table 1, so the structures are exactly the same. This methodology works in another app I built (different database), adding to the strangeness. When I attempt to use this command in my current app, though, I see the error mentioned in the title in the console. The error is called on the last field in the table. I even rebuilt the entire database from scratch in Lianja - it was originally imported - and STILL get the same error.

    Further info:
    • When I replace table2 with table1 in the code, thus copying from itself, it still spits out the same error
    • Using INSERT-VALUES on these tables works totally fine
    • using SELECT on these tables by itself works totally fine. Using SELECT into ARRAY, however, encounters Fatal system error (sql_select_convert_row_array() column=4 type=F) on the final field.
    • If I change the order of the fields in the tables, it always encounters the error on the final field.
    • The error occurs on two tables in the database and on no others. I can't see anything that separates the tables that work and the ones that don't.


    What's going on? I can't seem to find this error anywhere on the net.

    I'm using 2.1beta1 right now for context.

    Thanks for the help.
    Last edited by jmartyr; 2016-02-01 at 23:39.

  2. #2
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    5,730
    If you SET DEBUG ON then run the command additional debugging information will be written to debug.txt. Try the command in the console also.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  3. #3
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    5,730
    Also let me see the table structure.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  4. #4
    Junior Member
    Join Date
    Jul 2015
    Posts
    25
    Here's the debug output, I couldn't work anything out from it:

    Code:
    *
    * Lianja embedded database engine
    * Version 1.3.0
    * Compiled on Dec 26 2015 10:24:08
    *
    Error reported from file sql_select.c line 8711 n=164
    cmdline=EXPENSEITEM.FPRICE
    
    g_current=1
    database=C:\Lianja\data\se_cu\
    u->name=C:\Lianja\data\se_cu\expenseitem.dbf
    u->alias=EXPENSEITEM
    Stacktrace:
    
    *** ERROR *** called from sql_select.c at line 8711 n=164 g_cmdpos=19 g_cmdlen=19 lex=1, g_uci=-1
    on error: 
    error number: 164
    error message: Internal error - sql_select_into_memvar()
    cmdbuf: EXPENSEITEM.FPRICE
    
    current=1
    database=C:\Lianja\data\se_cu\
    * u->name=C:\Lianja\data\se_cu\expenseitem.dbf
    * u->alias=EXPENSEITEM
    Stacktrace:
    
    Error reported from file sql_insert.c line 419 n=5015
    cmdline=INSERT INTO expenseitem * from temp_expenseitem
    
    g_current=6
    database=C:\Lianja\data\se_cu\
    u->name=C:\Lianja\data\se_cu\authoritytype.dbf
    u->alias=AUTHORITYTYPE
    Stacktrace:
    
    *** ERROR *** called from sql_insert.c at line 419 n=5015 g_cmdpos=25 g_cmdlen=48 lex=207, g_uci=-1
    on error: 
    error number: 5015
    error message: Keyword VALUES expected
    cmdbuf: INSERT INTO expenseitem * from temp_expenseitem
    
    current=6
    database=C:\Lianja\data\se_cu\
    * u->name=C:\Lianja\data\se_cu\authoritytype.dbf
    * u->alias=AUTHORITYTYPE
    Stacktrace:
    
    Error reported from file sql_select.c line 8711 n=164
    cmdline=TEMP_EXPENSEITEM.FPRICE
    
    g_current=0
    database=C:\Lianja\data\se_cu\
    u->name=C:\Lianja\data\se_cu\temp_expenseitem.dbf
    u->alias=TEMP_EXPENSEITEM
    Stacktrace:
    
    *** ERROR *** called from sql_select.c at line 8711 n=164 g_cmdpos=24 g_cmdlen=24 lex=1, g_uci=-1
    on error: 
    error number: 164
    error message: Internal error - sql_select_into_memvar()
    cmdbuf: TEMP_EXPENSEITEM.FPRICE
    
    current=0
    database=C:\Lianja\data\se_cu\
    * u->name=C:\Lianja\data\se_cu\temp_expenseitem.dbf
    * u->alias=TEMP_EXPENSEITEM
    Stacktrace:
    Is there a way to export table structures from Lianja?

  5. #5
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    5,730
    Hi Joanna,

    The debug output helps me.

    What is the exact command you are executing.

    list structure

    so I can see the structure if the two tables. It seems it may be when a float data type us used. I'll look into that and fix it up.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  6. #6
    Junior Member
    Join Date
    Jul 2015
    Posts
    25
    Hi Barry,

    The exact command is
    Code:
    INSERT INTO expenseitem SELECT * FROM temp_expenseitem
    The table structure is:

    Expense ID:
    Name: IEXPID_PK
    Type: Int
    Width: 4
    Mandatory

    Claim ID:
    Name: ICLAIMID_FK
    Type: Int
    Width: 4
    Mandatory

    Item:
    Name: CITEM
    Type: Character
    Width: 10

    Quantity:
    Name: IQUANTITY
    Type: Int
    Width: 4
    Mandatory

    Price:
    Name: FPRICE
    Type: Float
    Width: 6
    Decimals: 2
    Mandatory

    The temp database is exactly the same structure as discussed in the original post. You may be on to something with the Float type, the only other table in my database with a float field is also the only other table that causes this error.

  7. #7
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    5,730
    Ok i'll take a look. I think float is not being handled properly.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  8. #8
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    5,730
    I have fixed this in v2.1Beta5 which I will upload today.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Journey into the Cloud
Join us