Skip to content

Using extension function in a VIEW causes exception to be printed #265

Description

@BroadlyWhitaker

With current git:

.load ./crypto -- included in popular sqlean extension for sqlite

CREATE TABLE products (
    product_id INTEGER PRIMARY KEY,
    product_name TEXT NOT NULL
);

INSERT INTO products (product_name) VALUES ('Wireless Mouse');

CREATE VIEW v_hashed_product_id AS
SELECT 
    hex(crypto_blake3(product_id))
FROM products;

Running this in the REPL prints out this exception:

  File "site-packages/litecli/completion_refresher.py", line 85, in _bg_refresh
    refresher(completer, executor)
    ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
  File "site-packages/litecli/completion_refresher.py", line 128, in refresh_tables
    table_cols = list(executor.table_columns())
  File "site-packages/litecli/sqlexecute.py", line 197, in table_columns
    cur.execute(self.table_columns_query)
    ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
sqlite3.OperationalError: no such function: crypto_blake3

but the view is created and works as expected.

Furthermore, existing and then opening the db in litecli also prints this exception:

$ litecli ./my.db
  File "site-packages/litecli/completion_refresher.py", line 85, in _bg_refresh
    refresher(completer, executor)
    ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
  File "site-packages/litecli/completion_refresher.py", line 128, in refresh_tables
    table_cols = list(executor.table_columns())
  File "site-packages/litecli/sqlexecute.py", line 197, in table_columns
    cur.execute(self.table_columns_query)
    ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
sqlite3.OperationalError: no such function: crypto_blake3
my.db>

Here's a link to sqlean binaries for testing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions