babelfish_extensions icon indicating copy to clipboard operation
babelfish_extensions copied to clipboard

[Bug]: Drop table error: could not open relation with OID 0

Open zxwsbg opened this issue 8 months ago • 2 comments

What happened?

I use old babelfish kernel & babelfish extension initdb, and use tsql create table t

Then I compile latest babelfish kernel & babelfish extesnion and restart db.

Then I run drop table stmt and got error: Msg 33557097 (severity 16, state 1) from BABELFISH Line 2: "could not open relation with OID 0"

#0  errfinish (filename=0xbccea0 "relation.c", lineno=62, 
    funcname=0xbccfc8 <__func__.1> "relation_open") at elog.c:510
#1  0x00000000004aa9d4 in relation_open (relationId=0, lockmode=3)
    at relation.c:62
#2  0x00000000005716f4 in table_open (relationId=0, lockmode=3) at table.c:43
#3  0x00007fe273de3a95 in clean_up_bbf_schema_permissions (
    schema_name=0x23f3c00 "dbo", object_name=0x23f2bd8 "t", is_schema=false)
    at src/catalog.c:3525
#4  0x00007fe273d0e1dd in bbf_ExecDropStmt (stmt=0x249b4e8)
    at src/pl_handler.c:6556
#5  0x00007fe273d04e88 in bbf_ProcessUtility (pstmt=0x249b450, 
    queryString=0x240c740 "drop table t;", readOnlyTree=true, 
    context=PROCESS_UTILITY_QUERY, params=0x0, queryEnv=0x0, 
    dest=0xd3f0c0 <spi_printtupDR>, qc=0x7ffc6f1f9fc0)
    at src/pl_handler.c:3643
#6  0x00000000009a9cd7 in ProcessUtility (pstmt=0x249b450, 
    queryString=0x240c740 "drop table t;", readOnlyTree=true, 
    context=PROCESS_UTILITY_QUERY, params=0x0, queryEnv=0x0, 
    dest=0xd3f0c0 <spi_printtupDR>, qc=0x7ffc6f1f9fc0) at utility.c:529
#7  0x00000000007be976 in _SPI_execute_plan (plan=0x24b1500, 
    options=0x7ffc6f1fa100, snapshot=0x0, crosscheck_snapshot=0x0, 
    fire_triggers=true) at spi.c:2765
#8  0x00000000007bb7c3 in SPI_execute_plan_with_paramlist (plan=0x24b1500, 
    params=0x0, read_only=false, tcount=0) at spi.c:766
#9  0x00007fe273d2e3da in exec_stmt_execsql (estate=0x7ffc6f1fa710, 
    stmt=0x2415e38) at src/pl_exec.c:4840
#10 0x00007fe273d246ee in dispatch_stmt (estate=0x7ffc6f1fa710, 
    stmt=0x2415e38) at src/iterative_exec.c:666
---Type <return> to continue, or q <return> to quit---
#11 0x00007fe273d25c9a in dispatch_stmt_handle_error (estate=0x7ffc6f1fa710, 
    stmt=0x2415e38, terminate_batch=0x7ffc6f1fa4e1, active_non_tsql_procs=0, 
    active_sys_functions=0) at src/iterative_exec.c:1274
#12 0x00007fe273d26c50 in exec_stmt_iterative (estate=0x7ffc6f1fa710, 
    exec_codes=0x2416328, config=0x7ffc6f1fa6a8) at src/iterative_exec.c:1598
#13 0x00007fe273d1578d in pltsql_exec_function (func=0x239cfe0, 
    fcinfo=0x1be4fa8, simple_eval_estate=0x2386fb0, atomic=false)
    at src/pl_exec.c:688
#14 0x00007fe273d0a8b8 in pltsql_inline_handler (fcinfo=0x7ffc6f1fad00)
    at src/pl_handler.c:5356
#15 0x00007fe27d96e64a in ExecuteSQLBatch (
    query=0x1c0df30 "use d1;\ndrop table t;\n")
    at src/backend/tds/tdssqlbatch.c:94
#16 0x00007fe27d96e868 in ProcessSQLBatchRequest (request=0x1c0def8)
    at src/backend/tds/tdssqlbatch.c:142
#17 0x00007fe27d97370d in ProcessTDSRequest (request=0x1c0def8)
    at src/backend/tds/tdsprotocol.c:422
#18 0x00007fe27d97425a in TdsSocketBackend ()
    at src/backend/tds/tdsprotocol.c:666
#19 0x00007fe27d9762e4 in pe_process_command ()
    at src/backend/tds/tds_srv.c:453
#20 0x00000000009a6186 in PostgresMain (dbname=0x1bdf840 "babelfish_db", 
    username=0x1bdf7f8 "babelfish_user") at postgres.c:4719
#21 0x00007fe27d97617c in pe_mainfunc (port=0x1c0ab30)
    at src/backend/tds/tds_srv.c:387
#22 0x00000000008e1951 in BackendRun (port=0x1c0ab30) at postmaster.c:4689
#23 0x00000000008e12cf in BackendStartup (port=0x1c0ab30) at postmaster.c:4416
#24 0x00000000008dd7e2 in ServerLoop () at postmaster.c:1982
---Type <return> to continue, or q <return> to quit---
#25 0x00000000008dcd94 in PostmasterMain (argc=3, argv=0x1bde620)
    at postmaster.c:1516
#26 0x00000000007e10b7 in main (argc=3, argv=0x1bde620) at main.c:204

Version

BABEL_3_X_DEV

Extension

None

Which flavor of Linux are you using when you see the bug?

No response

Relevant log output


Code of Conduct

  • [x] I agree to follow this project's Code of Conduct.

zxwsbg avatar Apr 14 '25 03:04 zxwsbg

Can you also paste the current extensions version in your babelfish database.

tanscorpio7 avatar Apr 15 '25 09:04 tanscorpio7

Please connect to postgres database where extensions are installed, run the following query to check if extensions are upto date.

select * from pg_available_extensions where installed_version is not null order by name;

If they are not the latest then please upgrade extensions manually by running following command from same database.

begin;
ALTER EXTENSION babelfishpg_common UPDATE; 
ALTER EXTENSION babelfishpg_tsql UPDATE;
commit;

Deepesh125 avatar Apr 17 '25 06:04 Deepesh125