studio icon indicating copy to clipboard operation
studio copied to clipboard

Views not loading correctly

Open hassanad94 opened this issue 1 year ago • 7 comments

Screenshot 2025-01-07 at 17 33 42

Error: Error invoking remote method 'query': LibsqlError: SQLITE_ERROR: no such column: propertyIDs

select * from propertyIDs its working fine.

Screenshot 2025-01-07 at 17 34 12

hassanad94 avatar Jan 07 '25 16:01 hassanad94

Thanks for reporting. I am looking into it.

Is this SQLite file, Cloudflare D1 or Turso?

invisal avatar Jan 07 '25 17:01 invisal

Its a SQLite file.

hassanad94 avatar Jan 08 '25 11:01 hassanad94

Thats my schema

sqlite> .schema propertyIDs CREATE VIEW propertyIDs AS SELECT * FROM (SELECT (ROW_NUMBER() OVER (ORDER BY created)) AS id_number, id, table_name, featured, updated, price, for_sale, off_market, active, long_address, address, created, uploader FROM ( SELECT id, 'houses' AS table_name, featured, price, for_sale, off_market, updated, active, long_address, address, created, uploader FROM houses UNION SELECT id, 'flats' AS table_name, featured, price, for_sale, off_market, updated, active, long_address, address, created, uploaderFROM flats UNION SELECT id, 'lands' AS table_name, featured, price, for_sale, off_market, updated, active, long_address, address, created, uploader FROM lands ) AS combined_table ORDER BY created);

hassanad94 avatar Jan 08 '25 11:01 hassanad94

image

Can you toggle developer tool. Then click on view again. The console will tell which SQL does it execute. Can you copy and paste the SQL here?

Thanks

invisal avatar Jan 08 '25 12:01 invisal

I has the same error by using libsql server.

This is what cause the problem: SELECT * FROM "main".pragma_table_info("xxx");

xxx is a the view I'd like to open

peterreisz avatar Jan 24 '25 16:01 peterreisz

I has the same error by using libsql server.

This is what cause the problem: SELECT * FROM "main".pragma_table_info("xxx");

xxx is a the view I'd like to open

Thanks for providing additional information. When you try to run

SELECT * FROM "main".pragma_table_info("xxx");

In the query tab, what error message does it provide? I have many views and using this SQL query will always returning the correct result. Is there any minimal steps that I can reproduce?

I has the same error by using libsql server.

Is it local libsql server or cloud-hosted provided by Turso?

invisal avatar Jan 24 '25 17:01 invisal

  1. Download the libsql server binary: https://github.com/tursodatabase/libsql/releases/tag/libsql-server-v0.24.31
  2. Start it in a terminal sqld --http-listen-addr=0.0.0.0:8080
  3. Connect to it via turso/libsql option in studio (url: http://localhost:8080, token is empty)
  4. Create table: CREATE TABLE foo (bar text);
  5. Create a view: CREATE VIEW v_foo AS SELECT * FROM foo
  6. Open the view

peterreisz avatar Jan 24 '25 17:01 peterreisz