-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbare_col_label.sql
More file actions
43 lines (34 loc) · 1.16 KB
/
bare_col_label.sql
File metadata and controls
43 lines (34 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
-- Test bare column labels (aliases without AS keyword)
-- These should parse successfully because 'name', 'value', 'action' etc are bare_label_keywords
-- Basic bare labels with unreserved keywords
SELECT 1 name;
SELECT 1 value;
SELECT 1 action;
SELECT 1 data;
-- Bare labels with reserved keywords that are also bare_label_keywords
SELECT 1 all;
SELECT 1 table;
SELECT 1 select;
-- Bare labels with col_name_keywords
SELECT 1 int;
SELECT 1 timestamp;
SELECT 1 json;
-- Bare labels with type_func_name_keywords
SELECT 1 left;
SELECT 1 right;
SELECT 1 join;
-- Multiple columns with bare labels
SELECT 1 name, 2 value, 3 action;
-- Mixed with and without AS
SELECT 1 AS alias1, 2 alias2, 3 AS alias3;
-- Expression with bare label
SELECT 1 + 2 result;
SELECT a.id name FROM t a;
-- Subquery with bare label
SELECT * FROM (SELECT 1 name) sub;
-- NOTE: The following require AS keyword (AS_LABEL keywords):
-- SELECT 1 AS year; -- 'year' is AS_LABEL, needs AS
-- SELECT 1 AS month; -- 'month' is AS_LABEL, needs AS
-- SELECT 1 AS day; -- 'day' is AS_LABEL, needs AS
-- SELECT 1 AS hour; -- 'hour' is AS_LABEL, needs AS
-- SELECT 1 AS char; -- 'char' is AS_LABEL, needs AS