-- Migrated from DuckDB test: test/sql/select/test_select_qualified_view.test
-- Description: Test selecting a view through a qualified reference
CREATE SCHEMA s;

Affected Rows: 1

-- Create table with TIME INDEX for GreptimeDB
CREATE TABLE s.a(col1 STRING, ts TIMESTAMP TIME INDEX);

Affected Rows: 0

INSERT INTO s.a VALUES ('hello', 1000);

Affected Rows: 1

-- Create view
CREATE VIEW s.b AS SELECT * FROM s.a;

Affected Rows: 0

-- Test schema-qualified view reference
SELECT s.b.col1 FROM s.b;

+-------+
| col1  |
+-------+
| hello |
+-------+

-- Test table-qualified view reference  
SELECT b.col1 FROM s.b;

+-------+
| col1  |
+-------+
| hello |
+-------+

-- Clean up
DROP VIEW s.b;

Affected Rows: 0

DROP TABLE s.a;

Affected Rows: 0

DROP SCHEMA s;

Affected Rows: 0

