pg_query 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9cb01b49c6ea65d1ff126562ce68adaa5635d37093ff726b1bc70d65c341ae9e
4
- data.tar.gz: 4dc7fa1bf00d7ff6036a79d8a38fd9f3e383f449b21f0d53f0168be7d32df89a
3
+ metadata.gz: 7e8912d6c8962c7e999e1a14d4258f0553cdf6e538e20e6374cb4b362118ec84
4
+ data.tar.gz: e27779fc7d4e15c76d8a38195541240c2b48508d2d07fe17eef715ac00e91a06
5
5
  SHA512:
6
- metadata.gz: ad48c885044147fcc9fa406543fc8a805c789fa227d71000bd1d25be0846aa1f7e183420e7ee86df262ff0d7ae668f2c4b1cd4ef15f5d305d5deeb5d86d6e8ad
7
- data.tar.gz: 860aa2345238226eaf5594d20d34af5a6aed39177a0900e0b72e79771586f96bf2917ac73722d3672cf730e18c2977cd275617fe411e79b4af8266ac4e499124
6
+ metadata.gz: 8eaa86d4571c15b3ea496bf5f85a4e2b1c69f5b1c2f2ad179862d020ca00d6fac160f0a1296707d0bee802f5b0e7cf29b466deb4c04927ec6e6987e31d2347f7
7
+ data.tar.gz: d766dc39d5b3ec3ee9fe1809ece77ca8a83c78290e4d72893e86cff37e4d47eac18b2dc18437807e2f5b4a4c50ccfe518831a9dae9e7bdd7cfd778eed86c9415
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.2.0 2019-11-10
4
+
5
+ * Reduce escaped keywords to Postgres-specific keywords, and ignore unreserved keywords
6
+ * This matches the behaviour of Postgres' quote_identifier function, and avoids problems
7
+ when doing text comparisons with output involving that function
8
+ * Note that this will lead to different output than in earlier pg_query versions,
9
+ in some cases
10
+
3
11
  ## 1.1.1 2019-11-10
4
12
 
5
13
  * Deparsing improvements by [@emin100](https://github.com/emin100)
@@ -1,760 +1,159 @@
1
1
  class PgQuery
2
2
  module Deparse # rubocop:disable Metrics/ModuleLength
3
- # Copy of https://www.postgresql.org/docs/current/sql-keywords-appendix.html
4
- # to make sure we escape identifiers that are reserved or non-reserved keywords
5
- KEYWORDS = [
6
- 'A',
7
- 'ABORT',
8
- 'ABS',
9
- 'ABSENT',
10
- 'ABSOLUTE',
11
- 'ACCESS',
12
- 'ACCORDING',
13
- 'ACTION',
14
- 'ADA',
15
- 'ADD',
16
- 'ADMIN',
17
- 'AFTER',
18
- 'AGGREGATE',
19
- 'ALL',
20
- 'ALLOCATE',
21
- 'ALSO',
22
- 'ALTER',
23
- 'ALWAYS',
24
- 'ANALYSE',
25
- 'ANALYZE',
26
- 'AND',
27
- 'ANY',
28
- 'ARE',
29
- 'ARRAY',
30
- 'ARRAY_AGG',
31
- 'ARRAY_MAX_CARDINALITY',
32
- 'AS',
33
- 'ASC',
34
- 'ASENSITIVE',
35
- 'ASSERTION',
36
- 'ASSIGNMENT',
37
- 'ASYMMETRIC',
38
- 'AT',
39
- 'ATOMIC',
40
- 'ATTRIBUTE',
41
- 'ATTRIBUTES',
42
- 'AUTHORIZATION',
43
- 'AVG',
44
- 'BACKWARD',
45
- 'BASE64',
46
- 'BEFORE',
47
- 'BEGIN',
48
- 'BEGIN_FRAME',
49
- 'BEGIN_PARTITION',
50
- 'BERNOULLI',
51
- 'BETWEEN',
52
- 'BIGINT',
53
- 'BINARY',
54
- 'BIT',
55
- 'BIT_LENGTH',
56
- 'BLOB',
57
- 'BLOCKED',
58
- 'BOM',
59
- 'BOOLEAN',
60
- 'BOTH',
61
- 'BREADTH',
62
- 'BY',
63
- 'C',
64
- 'CACHE',
65
- 'CALL',
66
- 'CALLED',
67
- 'CARDINALITY',
68
- 'CASCADE',
69
- 'CASCADED',
70
- 'CASE',
71
- 'CAST',
72
- 'CATALOG',
73
- 'CATALOG_NAME',
74
- 'CEIL',
75
- 'CEILING',
76
- 'CHAIN',
77
- 'CHAR',
78
- 'CHARACTER',
79
- 'CHARACTERISTICS',
80
- 'CHARACTERS',
81
- 'CHARACTER_LENGTH',
82
- 'CHARACTER_SET_CATALOG',
83
- 'CHARACTER_SET_NAME',
84
- 'CHARACTER_SET_SCHEMA',
85
- 'CHAR_LENGTH',
86
- 'CHECK',
87
- 'CHECKPOINT',
88
- 'CLASS',
89
- 'CLASS_ORIGIN',
90
- 'CLOB',
91
- 'CLOSE',
92
- 'CLUSTER',
93
- 'COALESCE',
94
- 'COBOL',
95
- 'COLLATE',
96
- 'COLLATION',
97
- 'COLLATION_CATALOG',
98
- 'COLLATION_NAME',
99
- 'COLLATION_SCHEMA',
100
- 'COLLECT',
101
- 'COLUMN',
102
- 'COLUMNS',
103
- 'COLUMN_NAME',
104
- 'COMMAND_FUNCTION',
105
- 'COMMAND_FUNCTION_CODE',
106
- 'COMMENT',
107
- 'COMMENTS',
108
- 'COMMIT',
109
- 'COMMITTED',
110
- 'CONCURRENTLY',
111
- 'CONDITION',
112
- 'CONDITION_NUMBER',
113
- 'CONFIGURATION',
114
- 'CONFLICT',
115
- 'CONNECT',
116
- 'CONNECTION',
117
- 'CONNECTION_NAME',
118
- 'CONSTRAINT',
119
- 'CONSTRAINTS',
120
- 'CONSTRAINT_CATALOG',
121
- 'CONSTRAINT_NAME',
122
- 'CONSTRAINT_SCHEMA',
123
- 'CONSTRUCTOR',
124
- 'CONTAINS',
125
- 'CONTENT',
126
- 'CONTINUE',
127
- 'CONTROL',
128
- 'CONVERSION',
129
- 'CONVERT',
130
- 'COPY',
131
- 'CORR',
132
- 'CORRESPONDING',
133
- 'COST',
134
- 'COUNT',
135
- 'COVAR_POP',
136
- 'COVAR_SAMP',
137
- 'CREATE',
138
- 'CROSS',
139
- 'CSV',
140
- 'CUBE',
141
- 'CUME_DIST',
142
- 'CURRENT',
143
- 'CURRENT_CATALOG',
144
- 'CURRENT_DATE',
145
- 'CURRENT_DEFAULT_TRANSFORM_GROUP',
146
- 'CURRENT_PATH',
147
- 'CURRENT_ROLE',
148
- 'CURRENT_ROW',
149
- 'CURRENT_SCHEMA',
150
- 'CURRENT_TIME',
151
- 'CURRENT_TIMESTAMP',
152
- 'CURRENT_TRANSFORM_GROUP_FOR_TYPE',
153
- 'CURRENT_USER',
154
- 'CURSOR',
155
- 'CURSOR_NAME',
156
- 'CYCLE',
157
- 'DATA',
158
- 'DATABASE',
159
- 'DATALINK',
160
- 'DATE',
161
- 'DATETIME_INTERVAL_CODE',
162
- 'DATETIME_INTERVAL_PRECISION',
163
- 'DAY',
164
- 'DB',
165
- 'DEALLOCATE',
166
- 'DEC',
167
- 'DECIMAL',
168
- 'DECLARE',
169
- 'DEFAULT',
170
- 'DEFAULTS',
171
- 'DEFERRABLE',
172
- 'DEFERRED',
173
- 'DEFINED',
174
- 'DEFINER',
175
- 'DEGREE',
176
- 'DELETE',
177
- 'DELIMITER',
178
- 'DELIMITERS',
179
- 'DENSE_RANK',
180
- 'DEPENDS',
181
- 'DEPTH',
182
- 'DEREF',
183
- 'DERIVED',
184
- 'DESC',
185
- 'DESCRIBE',
186
- 'DESCRIPTOR',
187
- 'DETERMINISTIC',
188
- 'DIAGNOSTICS',
189
- 'DICTIONARY',
190
- 'DISABLE',
191
- 'DISCARD',
192
- 'DISCONNECT',
193
- 'DISPATCH',
194
- 'DISTINCT',
195
- 'DLNEWCOPY',
196
- 'DLPREVIOUSCOPY',
197
- 'DLURLCOMPLETE',
198
- 'DLURLCOMPLETEONLY',
199
- 'DLURLCOMPLETEWRITE',
200
- 'DLURLPATH',
201
- 'DLURLPATHONLY',
202
- 'DLURLPATHWRITE',
203
- 'DLURLSCHEME',
204
- 'DLURLSERVER',
205
- 'DLVALUE',
206
- 'DO',
207
- 'DOCUMENT',
208
- 'DOMAIN',
209
- 'DOUBLE',
210
- 'DROP',
211
- 'DYNAMIC',
212
- 'DYNAMIC_FUNCTION',
213
- 'DYNAMIC_FUNCTION_CODE',
214
- 'EACH',
215
- 'ELEMENT',
216
- 'ELSE',
217
- 'EMPTY',
218
- 'ENABLE',
219
- 'ENCODING',
220
- 'ENCRYPTED',
221
- 'END',
222
- 'END-EXEC',
223
- 'END_FRAME',
224
- 'END_PARTITION',
225
- 'ENFORCED',
226
- 'ENUM',
227
- 'EQUALS',
228
- 'ESCAPE',
229
- 'EVENT',
230
- 'EVERY',
231
- 'EXCEPT',
232
- 'EXCEPTION',
233
- 'EXCLUDE',
234
- 'EXCLUDING',
235
- 'EXCLUSIVE',
236
- 'EXEC',
237
- 'EXECUTE',
238
- 'EXISTS',
239
- 'EXP',
240
- 'EXPLAIN',
241
- 'EXPRESSION',
242
- 'EXTENSION',
243
- 'EXTERNAL',
244
- 'EXTRACT',
245
- 'FALSE',
246
- 'FAMILY',
247
- 'FETCH',
248
- 'FILE',
249
- 'FILTER',
250
- 'FINAL',
251
- 'FIRST',
252
- 'FIRST_VALUE',
253
- 'FLAG',
254
- 'FLOAT',
255
- 'FLOOR',
256
- 'FOLLOWING',
257
- 'FOR',
258
- 'FORCE',
259
- 'FOREIGN',
260
- 'FORTRAN',
261
- 'FORWARD',
262
- 'FOUND',
263
- 'FRAME_ROW',
264
- 'FREE',
265
- 'FREEZE',
266
- 'FROM',
267
- 'FS',
268
- 'FULL',
269
- 'FUNCTION',
270
- 'FUNCTIONS',
271
- 'FUSION',
272
- 'G',
273
- 'GENERAL',
274
- 'GENERATED',
275
- 'GET',
276
- 'GLOBAL',
277
- 'GO',
278
- 'GOTO',
279
- 'GRANT',
280
- 'GRANTED',
281
- 'GREATEST',
282
- 'GROUP',
283
- 'GROUPING',
284
- 'GROUPS',
285
- 'HANDLER',
286
- 'HAVING',
287
- 'HEADER',
288
- 'HEX',
289
- 'HIERARCHY',
290
- 'HOLD',
291
- 'HOUR',
292
- 'ID',
293
- 'IDENTITY',
294
- 'IF',
295
- 'IGNORE',
296
- 'ILIKE',
297
- 'IMMEDIATE',
298
- 'IMMEDIATELY',
299
- 'IMMUTABLE',
300
- 'IMPLEMENTATION',
301
- 'IMPLICIT',
302
- 'IMPORT',
303
- 'IN',
304
- 'INCLUDING',
305
- 'INCREMENT',
306
- 'INDENT',
307
- 'INDEX',
308
- 'INDEXES',
309
- 'INDICATOR',
310
- 'INHERIT',
311
- 'INHERITS',
312
- 'INITIALLY',
313
- 'INLINE',
314
- 'INNER',
315
- 'INOUT',
316
- 'INPUT',
317
- 'INSENSITIVE',
318
- 'INSERT',
319
- 'INSTANCE',
320
- 'INSTANTIABLE',
321
- 'INSTEAD',
322
- 'INT',
323
- 'INTEGER',
324
- 'INTEGRITY',
325
- 'INTERSECT',
326
- 'INTERSECTION',
327
- 'INTERVAL',
328
- 'INTO',
329
- 'INVOKER',
330
- 'IS',
331
- 'ISNULL',
332
- 'ISOLATION',
333
- 'JOIN',
334
- 'K',
335
- 'KEY',
336
- 'KEY_MEMBER',
337
- 'KEY_TYPE',
338
- 'LABEL',
339
- 'LAG',
340
- 'LANGUAGE',
341
- 'LARGE',
342
- 'LAST',
343
- 'LAST_VALUE',
344
- 'LATERAL',
345
- 'LEAD',
346
- 'LEADING',
347
- 'LEAKPROOF',
348
- 'LEAST',
349
- 'LEFT',
350
- 'LENGTH',
351
- 'LEVEL',
352
- 'LIBRARY',
353
- 'LIKE',
354
- 'LIKE_REGEX',
355
- 'LIMIT',
356
- 'LINK',
357
- 'LISTEN',
358
- 'LN',
359
- 'LOAD',
360
- 'LOCAL',
361
- 'LOCALTIME',
362
- 'LOCALTIMESTAMP',
363
- 'LOCATION',
364
- 'LOCATOR',
365
- 'LOCK',
366
- 'LOCKED',
367
- 'LOGGED',
368
- 'LOWER',
369
- 'M',
370
- 'MAP',
371
- 'MAPPING',
372
- 'MATCH',
373
- 'MATCHED',
374
- 'MATERIALIZED',
375
- 'MAX',
376
- 'MAXVALUE',
377
- 'MAX_CARDINALITY',
378
- 'MEMBER',
379
- 'MERGE',
380
- 'MESSAGE_LENGTH',
381
- 'MESSAGE_OCTET_LENGTH',
382
- 'MESSAGE_TEXT',
383
- 'METHOD',
384
- 'MIN',
385
- 'MINUTE',
386
- 'MINVALUE',
387
- 'MOD',
388
- 'MODE',
389
- 'MODIFIES',
390
- 'MODULE',
391
- 'MONTH',
392
- 'MORE',
393
- 'MOVE',
394
- 'MULTISET',
395
- 'MUMPS',
396
- 'NAME',
397
- 'NAMES',
398
- 'NAMESPACE',
399
- 'NATIONAL',
400
- 'NATURAL',
401
- 'NCHAR',
402
- 'NCLOB',
403
- 'NESTING',
404
- 'NEW',
405
- 'NEXT',
406
- 'NFC',
407
- 'NFD',
408
- 'NFKC',
409
- 'NFKD',
410
- 'NIL',
411
- 'NO',
412
- 'NONE',
413
- 'NORMALIZE',
414
- 'NORMALIZED',
415
- 'NOT',
416
- 'NOTHING',
417
- 'NOTIFY',
418
- 'NOTNULL',
419
- 'NOWAIT',
420
- 'NTH_VALUE',
421
- 'NTILE',
422
- 'NULL',
423
- 'NULLABLE',
424
- 'NULLIF',
425
- 'NULLS',
426
- 'NUMBER',
427
- 'NUMERIC',
428
- 'OBJECT',
429
- 'OCCURRENCES_REGEX',
430
- 'OCTETS',
431
- 'OCTET_LENGTH',
432
- 'OF',
433
- 'OFF',
434
- 'OFFSET',
435
- 'OIDS',
436
- 'OLD',
437
- 'ON',
438
- 'ONLY',
439
- 'OPEN',
440
- 'OPERATOR',
441
- 'OPTION',
442
- 'OPTIONS',
443
- 'OR',
444
- 'ORDER',
445
- 'ORDERING',
446
- 'ORDINALITY',
447
- 'OTHERS',
448
- 'OUT',
449
- 'OUTER',
450
- 'OUTPUT',
451
- 'OVER',
452
- 'OVERLAPS',
453
- 'OVERLAY',
454
- 'OVERRIDING',
455
- 'OWNED',
456
- 'OWNER',
457
- 'P',
458
- 'PAD',
459
- 'PARALLEL',
460
- 'PARAMETER',
461
- 'PARAMETER_MODE',
462
- 'PARAMETER_NAME',
463
- 'PARAMETER_ORDINAL_POSITION',
464
- 'PARAMETER_SPECIFIC_CATALOG',
465
- 'PARAMETER_SPECIFIC_NAME',
466
- 'PARAMETER_SPECIFIC_SCHEMA',
467
- 'PARSER',
468
- 'PARTIAL',
469
- 'PARTITION',
470
- 'PASCAL',
471
- 'PASSING',
472
- 'PASSTHROUGH',
473
- 'PASSWORD',
474
- 'PATH',
475
- 'PERCENT',
476
- 'PERCENTILE_CONT',
477
- 'PERCENTILE_DISC',
478
- 'PERCENT_RANK',
479
- 'PERIOD',
480
- 'PERMISSION',
481
- 'PLACING',
482
- 'PLANS',
483
- 'PLI',
484
- 'POLICY',
485
- 'PORTION',
486
- 'POSITION',
487
- 'POSITION_REGEX',
488
- 'POWER',
489
- 'PRECEDES',
490
- 'PRECEDING',
491
- 'PRECISION',
492
- 'PREPARE',
493
- 'PREPARED',
494
- 'PRESERVE',
495
- 'PRIMARY',
496
- 'PRIOR',
497
- 'PRIVILEGES',
498
- 'PROCEDURAL',
499
- 'PROCEDURE',
500
- 'PROGRAM',
501
- 'PUBLIC',
502
- 'QUOTE',
503
- 'RANGE',
504
- 'RANK',
505
- 'READ',
506
- 'READS',
507
- 'REAL',
508
- 'REASSIGN',
509
- 'RECHECK',
510
- 'RECOVERY',
511
- 'RECURSIVE',
512
- 'REF',
513
- 'REFERENCES',
514
- 'REFERENCING',
515
- 'REFRESH',
516
- 'REGR_AVGX',
517
- 'REGR_AVGY',
518
- 'REGR_COUNT',
519
- 'REGR_INTERCEPT',
520
- 'REGR_R2',
521
- 'REGR_SLOPE',
522
- 'REGR_SXX',
523
- 'REGR_SXY',
524
- 'REGR_SYY',
525
- 'REINDEX',
526
- 'RELATIVE',
527
- 'RELEASE',
528
- 'RENAME',
529
- 'REPEATABLE',
530
- 'REPLACE',
531
- 'REPLICA',
532
- 'REQUIRING',
533
- 'RESET',
534
- 'RESPECT',
535
- 'RESTART',
536
- 'RESTORE',
537
- 'RESTRICT',
538
- 'RESULT',
539
- 'RETURN',
540
- 'RETURNED_CARDINALITY',
541
- 'RETURNED_LENGTH',
542
- 'RETURNED_OCTET_LENGTH',
543
- 'RETURNED_SQLSTATE',
544
- 'RETURNING',
545
- 'RETURNS',
546
- 'REVOKE',
547
- 'RIGHT',
548
- 'ROLE',
549
- 'ROLLBACK',
550
- 'ROLLUP',
551
- 'ROUTINE',
552
- 'ROUTINE_CATALOG',
553
- 'ROUTINE_NAME',
554
- 'ROUTINE_SCHEMA',
555
- 'ROW',
556
- 'ROWS',
557
- 'ROW_COUNT',
558
- 'ROW_NUMBER',
559
- 'RULE',
560
- 'SAVEPOINT',
561
- 'SCALE',
562
- 'SCHEMA',
563
- 'SCHEMA_NAME',
564
- 'SCOPE',
565
- 'SCOPE_CATALOG',
566
- 'SCOPE_NAME',
567
- 'SCOPE_SCHEMA',
568
- 'SCROLL',
569
- 'SEARCH',
570
- 'SECOND',
571
- 'SECTION',
572
- 'SECURITY',
573
- 'SELECT',
574
- 'SELECTIVE',
575
- 'SELF',
576
- 'SENSITIVE',
577
- 'SEQUENCE',
578
- 'SEQUENCES',
579
- 'SERIALIZABLE',
580
- 'SERVER',
581
- 'SERVER_NAME',
582
- 'SESSION',
583
- 'SESSION_USER',
584
- 'SET',
585
- 'SETOF',
586
- 'SETS',
587
- 'SHARE',
588
- 'SHOW',
589
- 'SIMILAR',
590
- 'SIMPLE',
591
- 'SIZE',
592
- 'SKIP',
593
- 'SMALLINT',
594
- 'SNAPSHOT',
595
- 'SOME',
596
- 'SOURCE',
597
- 'SPACE',
598
- 'SPECIFIC',
599
- 'SPECIFICTYPE',
600
- 'SPECIFIC_NAME',
601
- 'SQL',
602
- 'SQLCODE',
603
- 'SQLERROR',
604
- 'SQLEXCEPTION',
605
- 'SQLSTATE',
606
- 'SQLWARNING',
607
- 'SQRT',
608
- 'STABLE',
609
- 'STANDALONE',
610
- 'START',
611
- 'STATE',
612
- 'STATEMENT',
613
- 'STATIC',
614
- 'STATISTICS',
615
- 'STDDEV_POP',
616
- 'STDDEV_SAMP',
617
- 'STDIN',
618
- 'STDOUT',
619
- 'STORAGE',
620
- 'STRICT',
621
- 'STRIP',
622
- 'STRUCTURE',
623
- 'STYLE',
624
- 'SUBCLASS_ORIGIN',
625
- 'SUBMULTISET',
626
- 'SUBSTRING',
627
- 'SUBSTRING_REGEX',
628
- 'SUCCEEDS',
629
- 'SUM',
630
- 'SYMMETRIC',
631
- 'SYSID',
632
- 'SYSTEM',
633
- 'SYSTEM_TIME',
634
- 'SYSTEM_USER',
635
- 'T',
636
- 'TABLE',
637
- 'TABLES',
638
- 'TABLESAMPLE',
639
- 'TABLESPACE',
640
- 'TABLE_NAME',
641
- 'TEMP',
642
- 'TEMPLATE',
643
- 'TEMPORARY',
644
- 'TEXT',
645
- 'THEN',
646
- 'TIES',
647
- 'TIME',
648
- 'TIMESTAMP',
649
- 'TIMEZONE_HOUR',
650
- 'TIMEZONE_MINUTE',
651
- 'TO',
652
- 'TOKEN',
653
- 'TOP_LEVEL_COUNT',
654
- 'TRAILING',
655
- 'TRANSACTION',
656
- 'TRANSACTIONS_COMMITTED',
657
- 'TRANSACTIONS_ROLLED_BACK',
658
- 'TRANSACTION_ACTIVE',
659
- 'TRANSFORM',
660
- 'TRANSFORMS',
661
- 'TRANSLATE',
662
- 'TRANSLATE_REGEX',
663
- 'TRANSLATION',
664
- 'TREAT',
665
- 'TRIGGER',
666
- 'TRIGGER_CATALOG',
667
- 'TRIGGER_NAME',
668
- 'TRIGGER_SCHEMA',
669
- 'TRIM',
670
- 'TRIM_ARRAY',
671
- 'TRUE',
672
- 'TRUNCATE',
673
- 'TRUSTED',
674
- 'TYPE',
675
- 'TYPES',
676
- 'UESCAPE',
677
- 'UNBOUNDED',
678
- 'UNCOMMITTED',
679
- 'UNDER',
680
- 'UNENCRYPTED',
681
- 'UNION',
682
- 'UNIQUE',
683
- 'UNKNOWN',
684
- 'UNLINK',
685
- 'UNLISTEN',
686
- 'UNLOGGED',
687
- 'UNNAMED',
688
- 'UNNEST',
689
- 'UNTIL',
690
- 'UNTYPED',
691
- 'UPDATE',
692
- 'UPPER',
693
- 'URI',
694
- 'USAGE',
695
- 'USER',
696
- 'USER_DEFINED_TYPE_CATALOG',
697
- 'USER_DEFINED_TYPE_CODE',
698
- 'USER_DEFINED_TYPE_NAME',
699
- 'USER_DEFINED_TYPE_SCHEMA',
700
- 'USING',
701
- 'VACUUM',
702
- 'VALID',
703
- 'VALIDATE',
704
- 'VALIDATOR',
705
- 'VALUE',
706
- 'VALUES',
707
- 'VALUE_OF',
708
- 'VARBINARY',
709
- 'VARCHAR',
710
- 'VARIADIC',
711
- 'VARYING',
712
- 'VAR_POP',
713
- 'VAR_SAMP',
714
- 'VERBOSE',
715
- 'VERSION',
716
- 'VERSIONING',
717
- 'VIEW',
718
- 'VIEWS',
719
- 'VOLATILE',
720
- 'WHEN',
721
- 'WHENEVER',
722
- 'WHERE',
723
- 'WHITESPACE',
724
- 'WIDTH_BUCKET',
725
- 'WINDOW',
726
- 'WITH',
727
- 'WITHIN',
728
- 'WITHOUT',
729
- 'WORK',
730
- 'WRAPPER',
731
- 'WRITE',
732
- 'XML',
733
- 'XMLAGG',
734
- 'XMLATTRIBUTES',
735
- 'XMLBINARY',
736
- 'XMLCAST',
737
- 'XMLCOMMENT',
738
- 'XMLCONCAT',
739
- 'XMLDECLARATION',
740
- 'XMLDOCUMENT',
741
- 'XMLELEMENT',
742
- 'XMLEXISTS',
743
- 'XMLFOREST',
744
- 'XMLITERATE',
745
- 'XMLNAMESPACES',
746
- 'XMLPARSE',
747
- 'XMLPI',
748
- 'XMLQUERY',
749
- 'XMLROOT',
750
- 'XMLSCHEMA',
751
- 'XMLSERIALIZE',
752
- 'XMLTABLE',
753
- 'XMLTEXT',
754
- 'XMLVALIDATE',
755
- 'YEAR',
756
- 'YES',
757
- 'ZONE'
3
+ # Keywords that need to be escaped during deparsing. This matches they keywords
4
+ # excaped by quote_identifier in Postgres ruleutils.c. You can refresh this
5
+ # list using the kwlist.h file (make sure to ignore UNRESERVED_KEYWORD entries)
6
+ KEYWORDS = %w[
7
+ ALL
8
+ ANALYSE
9
+ ANALYZE
10
+ AND
11
+ ANY
12
+ ARRAY
13
+ AS
14
+ ASC
15
+ ASYMMETRIC
16
+ AUTHORIZATION
17
+ BETWEEN
18
+ BIGINT
19
+ BINARY
20
+ BIT
21
+ BOOLEAN
22
+ BOTH
23
+ CASE
24
+ CAST
25
+ CHAR
26
+ CHARACTER
27
+ CHECK
28
+ COALESCE
29
+ COLLATE
30
+ COLLATION
31
+ COLUMN
32
+ CONCURRENTLY
33
+ CONSTRAINT
34
+ CREATE
35
+ CROSS
36
+ CURRENT_CATALOG
37
+ CURRENT_DATE
38
+ CURRENT_ROLE
39
+ CURRENT_SCHEMA
40
+ CURRENT_TIME
41
+ CURRENT_TIMESTAMP
42
+ CURRENT_USER
43
+ DEC
44
+ DECIMAL
45
+ DEFAULT
46
+ DEFERRABLE
47
+ DESC
48
+ DISTINCT
49
+ DO
50
+ ELSE
51
+ END
52
+ EXCEPT
53
+ EXISTS
54
+ EXTRACT
55
+ FALSE
56
+ FETCH
57
+ FLOAT
58
+ FOR
59
+ FOREIGN
60
+ FREEZE
61
+ FROM
62
+ FULL
63
+ GRANT
64
+ GREATEST
65
+ GROUP
66
+ GROUPING
67
+ HAVING
68
+ ILIKE
69
+ IN
70
+ INITIALLY
71
+ INNER
72
+ INOUT
73
+ INT
74
+ INTEGER
75
+ INTERSECT
76
+ INTERVAL
77
+ INTO
78
+ IS
79
+ ISNULL
80
+ JOIN
81
+ LATERAL
82
+ LEADING
83
+ LEAST
84
+ LEFT
85
+ LIKE
86
+ LIMIT
87
+ LOCALTIME
88
+ LOCALTIMESTAMP
89
+ NATIONAL
90
+ NATURAL
91
+ NCHAR
92
+ NONE
93
+ NOT
94
+ NOTNULL
95
+ NULL
96
+ NULLIF
97
+ NUMERIC
98
+ OFFSET
99
+ ON
100
+ ONLY
101
+ OR
102
+ ORDER
103
+ OUT
104
+ OUTER
105
+ OVERLAPS
106
+ OVERLAY
107
+ PLACING
108
+ POSITION
109
+ PRECISION
110
+ PRIMARY
111
+ REAL
112
+ REFERENCES
113
+ RETURNING
114
+ RIGHT
115
+ ROW
116
+ SELECT
117
+ SESSION_USER
118
+ SETOF
119
+ SIMILAR
120
+ SMALLINT
121
+ SOME
122
+ SUBSTRING
123
+ SYMMETRIC
124
+ TABLE
125
+ TABLESAMPLE
126
+ THEN
127
+ TIME
128
+ TIMESTAMP
129
+ TO
130
+ TRAILING
131
+ TREAT
132
+ TRIM
133
+ TRUE
134
+ UNION
135
+ UNIQUE
136
+ USER
137
+ USING
138
+ VALUES
139
+ VARCHAR
140
+ VARIADIC
141
+ VERBOSE
142
+ WHEN
143
+ WHERE
144
+ WINDOW
145
+ WITH
146
+ XMLATTRIBUTES
147
+ XMLCONCAT
148
+ XMLELEMENT
149
+ XMLEXISTS
150
+ XMLFOREST
151
+ XMLNAMESPACES
152
+ XMLPARSE
153
+ XMLPI
154
+ XMLROOT
155
+ XMLSERIALIZE
156
+ XMLTABLE
758
157
  ].freeze
759
158
  end
760
159
  end
@@ -1,3 +1,3 @@
1
1
  class PgQuery
2
- VERSION = '1.1.1'.freeze
2
+ VERSION = '1.2.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_query
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lukas Fittl