summaryrefslogtreecommitdiff
path: root/sqlparse/keywords.py
diff options
context:
space:
mode:
authorali-tny <aliteeney@googlemail.com>2020-09-26 16:29:40 +1000
committerAndi Albrecht <albrecht.andi@gmail.com>2020-09-30 07:21:06 +0200
commit4c570778b2e1c06e8bfcb3c48ae5baeff908fcdf (patch)
tree20daf054a67724accffe31f4c350f43c776b06ae /sqlparse/keywords.py
parent1499cffcd7c4d635b4297b44d48fb4fe94cf988e (diff)
downloadsqlparse-4c570778b2e1c06e8bfcb3c48ae5baeff908fcdf.tar.gz
Add postgres WINDOW keyword
Postgres allows statements of the form: ```sql SELECT col_1, col_2, SUM(col_3) OVER w FROM x WINDOW w AS (PARTITION BY col_1 ORDER BY col_2) ``` where the window is defined once at the end of the query (see https://www.postgresql.org/docs/9.5/sql-select.html). This change adds WINDOW as a postgres keyword, preventing queries like the above being misparsed, with table name and WINDOW being grouped into an single identifier <Identifier 'x WINDOW'>.
Diffstat (limited to 'sqlparse/keywords.py')
-rw-r--r--sqlparse/keywords.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/sqlparse/keywords.py b/sqlparse/keywords.py
index 68ced92..8c872fd 100644
--- a/sqlparse/keywords.py
+++ b/sqlparse/keywords.py
@@ -833,6 +833,7 @@ KEYWORDS_ORACLE = {
# PostgreSQL Syntax
KEYWORDS_PLPGSQL = {
+ 'WINDOW': tokens.Keyword,
'PARTITION': tokens.Keyword,
'OVER': tokens.Keyword,
'PERFORM': tokens.Keyword,