codekingpro/portable-devtools
114k
1##########################################################################2#3# pgAdmin 4 - PostgreSQL Tools4#5# Copyright (C) 2013 - 2024, The pgAdmin Development Team6# This software is released under the PostgreSQL Licence7#8##########################################################################9 10# ScanKeyword function for PostgreSQL 9.5rc111 12 13def scan_keyword(key):14 keywords = {15 'abort': 0,16 'absolute': 0,17 'access': 0,18 'action': 0,19 'add': 0,20 'admin': 0,21 'after': 0,22 'aggregate': 0,23 'all': 3,24 'also': 0,25 'alter': 0,26 'always': 0,27 'analyze': 3,28 'and': 3,29 'any': 3,30 'array': 3,31 'as': 3,32 'asc': 3,33 'assertion': 0,34 'assignment': 0,35 'asymmetric': 3,36 'at': 0,37 'attribute': 0,38 'authorization': 2,39 'backward': 0,40 'before': 0,41 'begin': 0,42 'between': 1,43 'bigint': 1,44 'binary': 2,45 'bit': 1,46 'boolean': 1,47 'both': 3,48 'by': 0,49 'cache': 0,50 'called': 0,51 'cascade': 0,52 'cascaded': 0,53 'case': 3,54 'cast': 3,55 'catalog': 0,56 'chain': 0,57 'char': 1,58 'character': 1,59 'characteristics': 0,60 'check': 3,61 'checkpoint': 0,62 'class': 0,63 'close': 0,64 'cluster': 0,65 'coalesce': 1,66 'collate': 3,67 'collation': 2,68 'column': 3,69 'comment': 0,70 'comments': 0,71 'commit': 0,72 'committed': 0,73 'concurrently': 2,74 'configuration': 0,75 'conflict': 0,76 'connection': 0,77 'constraint': 3,78 'constraints': 0,79 'content': 0,80 'continue': 0,81 'conversion': 0,82 'copy': 0,83 'cost': 0,84 'create': 3,85 'cross': 2,86 'csv': 0,87 'cube': 0,88 'current': 0,89 'current_catalog': 3,90 'current_date': 3,91 'current_role': 3,92 'current_schema': 2,93 'current_time': 3,94 'current_timestamp': 3,95 'current_user': 3,96 'cursor': 0,97 'cycle': 0,98 'data': 0,99 'database': 0,100 'day': 0,101 'deallocate': 0,102 'dec': 1,103 'decimal': 1,104 'declare': 0,105 'default': 3,106 'defaults': 0,107 'deferrable': 3,108 'deferred': 0,109 'definer': 0,110 'delete': 0,111 'delimiter': 0,112 'delimiters': 0,113 'desc': 3,114 'dictionary': 0,115 'disable': 0,116 'discard': 0,117 'distinct': 3,118 'do': 3,119 'document': 0,120 'domain': 0,121 'double': 0,122 'drop': 0,123 'each': 0,124 'else': 3,125 'enable': 0,126 'encoding': 0,127 'encrypted': 0,128 'end': 3,129 'enum': 0,130 'escape': 0,131 'event': 0,132 'except': 3,133 'exclude': 0,134 'excluding': 0,135 'exclusive': 0,136 'execute': 0,137 'exists': 1,138 'explain': 0,139 'extension': 0,140 'external': 0,141 'extract': 1,142 'false': 3,143 'family': 0,144 'fetch': 3,145 'filter': 0,146 'first': 0,147 'float': 1,148 'following': 0,149 'for': 3,150 'force': 0,151 'foreign': 3,152 'forward': 0,153 'freeze': 2,154 'from': 3,155 'full': 2,156 'function': 0,157 'functions': 0,158 'global': 0,159 'grant': 3,160 'granted': 0,161 'greatest': 1,162 'group': 3,163 'grouping': 1,164 'handler': 0,165 'having': 3,166 'header': 0,167 'hold': 0,168 'hour': 0,169 'identity': 0,170 'if': 0,171 'ilike': 2,172 'immediate': 0,173 'immutable': 0,174 'implicit': 0,175 'import': 0,176 'in': 3,177 'including': 0,178 'increment': 0,179 'index': 0,180 'indexes': 0,181 'inherit': 0,182 'inherits': 0,183 'initially': 3,184 'inline': 0,185 'inner': 2,186 'inout': 1,187 'input': 0,188 'insensitive': 0,189 'insert': 0,190 'instead': 0,191 'int': 1,192 'integer': 1,193 'intersect': 3,194 'interval': 1,195 'into': 3,196 'invoker': 0,197 'is': 2,198 'isnull': 2,199 'isolation': 0,200 'join': 2,201 'key': 0,202 'label': 0,203 'language': 0,204 'large': 0,205 'last': 0,206 'lateral': 3,207 'leading': 3,208 'leakproof': 0,209 'least': 1,210 'left': 2,211 'level': 0,212 'like': 2,213 'limit': 3,214 'listen': 0,215 'load': 0,216 'local': 0,217 'localtime': 3,218 'localtimestamp': 3,219 'location': 0,220 'lock': 0,221 'locked': 0,222 'logged': 0,223 'mapping': 0,224 'match': 0,225 'materialized': 0,226 'maxvalue': 0,227 'minute': 0,228 'minvalue': 0,229 'mode': 0,230 'month': 0,231 'move': 0,232 'name': 0,233 'names': 0,234 'national': 1,235 'natural': 2,236 'nchar': 1,237 'next': 0,238 'no': 0,239 'none': 1,240 'not': 3,241 'nothing': 0,242 'notify': 0,243 'notnull': 2,244 'nowait': 0,245 'null': 3,246 'nullif': 1,247 'nulls': 0,248 'numeric': 1,249 'object': 0,250 'of': 0,251 'off': 0,252 'offset': 3,253 'oids': 0,254 'on': 3,255 'only': 3,256 'operator': 0,257 'option': 0,258 'options': 0,259 'or': 3,260 'order': 3,261 'ordinality': 0,262 'out': 1,263 'outer': 2,264 'over': 0,265 'overlaps': 2,266 'overlay': 1,267 'owned': 0,268 'owner': 0,269 'parser': 0,270 'partial': 0,271 'partition': 0,272 'passing': 0,273 'password': 0,274 'placing': 3,275 'plans': 0,276 'policy': 0,277 'position': 1,278 'preceding': 0,279 'precision': 1,280 'prepare': 0,281 'prepared': 0,282 'preserve': 0,283 'primary': 3,284 'prior': 0,285 'privileges': 0,286 'procedural': 0,287 'procedure': 0,288 'program': 0,289 'quote': 0,290 'range': 0,291 'read': 0,292 'real': 1,293 'reassign': 0,294 'recheck': 0,295 'recursive': 0,296 'ref': 0,297 'references': 3,298 'refresh': 0,299 'reindex': 0,300 'relative': 0,301 'release': 0,302 'rename': 0,303 'repeatable': 0,304 'replace': 0,305 'replica': 0,306 'reset': 0,307 'restart': 0,308 'restrict': 0,309 'returning': 3,310 'returns': 0,311 'revoke': 0,312 'right': 2,313 'role': 0,314 'rollback': 0,315 'rollup': 0,316 'row': 1,317 'rows': 0,318 'rule': 0,319 'savepoint': 0,320 'schema': 0,321 'scroll': 0,322 'search': 0,323 'second': 0,324 'security': 0,325 'select': 3,326 'sequence': 0,327 'sequences': 0,328 'serializable': 0,329 'server': 0,330 'session': 0,331 'session_user': 3,332 'set': 0,333 'setof': 1,334 'sets': 0,335 'share': 0,336 'show': 0,337 'similar': 2,338 'simple': 0,339 'skip': 0,340 'smallint': 1,341 'snapshot': 0,342 'some': 3,343 'sql': 0,344 'stable': 0,345 'standalone': 0,346 'start': 0,347 'statement': 0,348 'statistics': 0,349 'stdin': 0,350 'stdout': 0,351 'storage': 0,352 'strict': 0,353 'strip': 0,354 'substring': 1,355 'symmetric': 3,356 'sysid': 0,357 'system': 0,358 'table': 3,359 'tables': 0,360 'tablesample': 2,361 'tablespace': 0,362 'temp': 0,363 'template': 0,364 'temporary': 0,365 'text': 0,366 'then': 3,367 'time': 1,368 'timestamp': 1,369 'to': 3,370 'trailing': 3,371 'transaction': 0,372 'transform': 0,373 'treat': 1,374 'trigger': 0,375 'trim': 1,376 'true': 3,377 'truncate': 0,378 'trusted': 0,379 'type': 0,380 'types': 0,381 'unbounded': 0,382 'uncommitted': 0,383 'unencrypted': 0,384 'union': 3,385 'unique': 3,386 'unknown': 0,387 'unlisten': 0,388 'unlogged': 0,389 'until': 0,390 'update': 0,391 'user': 3,392 'using': 3,393 'vacuum': 0,394 'valid': 0,395 'validate': 0,396 'validator': 0,397 'value': 0,398 'values': 1,399 'varchar': 1,400 'variadic': 3,401 'varying': 0,402 'verbose': 2,403 'version': 0,404 'view': 0,405 'views': 0,406 'volatile': 0,407 'when': 3,408 'where': 3,409 'whitespace': 0,410 'window': 3,411 'with': 3,412 'within': 0,413 'without': 0,414 'work': 0,415 'wrapper': 0,416 'write': 0,417 'xml': 0,418 'xmlattributes': 1,419 'xmlconcat': 1,420 'xmlelement': 1,421 'xmlexists': 1,422 'xmlforest': 1,423 'xmlparse': 1,424 'xmlpi': 1,425 'xmlroot': 1,426 'xmlserialize': 1,427 'year': 0,428 'yes': 0,429 'zone': 0,430 }431 432 return keywords.get(key, None)433 