以下是代码:
CREATE OR REPLACE VIEW skats_4 AS SELECT count(datums) AS
2014_gada_pieteikumi from pieteikums where date_part('YEAR',
datums)=2014;
我一直收到错误的文字“2014年附近的语法错误”(“2014_gada_pieteikumi”)。我看不出有什么问题。
答案 0 :(得分:3)
标签不应以数字开头。使用双引号或重命名标签
postgres=# select 10 as 2014_some;
ERROR: syntax error at or near "2014"
LINE 1: select 10 as 2014_some;
^
Time: 0.647 ms
postgres=# select 10 as "2014_some";
2014_some
───────────
10
(1 row)