pg_query 2.0.3 → 5.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +165 -0
- data/README.md +67 -29
- data/Rakefile +8 -23
- data/ext/pg_query/extconf.rb +21 -3
- data/ext/pg_query/include/pg_query.h +29 -4
- data/ext/pg_query/include/pg_query_enum_defs.c +551 -272
- data/ext/pg_query/include/pg_query_fingerprint_conds.c +563 -470
- data/ext/pg_query/include/pg_query_fingerprint_defs.c +5403 -3945
- data/ext/pg_query/include/pg_query_outfuncs_conds.c +402 -330
- data/ext/pg_query/include/pg_query_outfuncs_defs.c +1319 -1059
- data/ext/pg_query/include/pg_query_readfuncs_conds.c +141 -118
- data/ext/pg_query/include/pg_query_readfuncs_defs.c +1685 -1379
- data/ext/pg_query/include/{access → postgres/access}/amapi.h +47 -1
- data/ext/pg_query/include/{access → postgres/access}/attmap.h +5 -3
- data/ext/pg_query/include/{access → postgres/access}/attnum.h +2 -2
- data/ext/pg_query/include/{access → postgres/access}/clog.h +4 -2
- data/ext/pg_query/include/{access → postgres/access}/commit_ts.h +6 -9
- data/ext/pg_query/include/{access → postgres/access}/detoast.h +1 -11
- data/ext/pg_query/include/{access → postgres/access}/genam.h +21 -16
- data/ext/pg_query/include/{access → postgres/access}/gin.h +17 -4
- data/ext/pg_query/include/{access → postgres/access}/htup.h +1 -1
- data/ext/pg_query/include/{access → postgres/access}/htup_details.h +80 -88
- data/ext/pg_query/include/{access → postgres/access}/itup.h +61 -52
- data/ext/pg_query/include/{access → postgres/access}/parallel.h +2 -2
- data/ext/pg_query/include/{access → postgres/access}/printtup.h +1 -1
- data/ext/pg_query/include/{access → postgres/access}/relation.h +1 -1
- data/ext/pg_query/include/{access → postgres/access}/relscan.h +17 -2
- data/ext/pg_query/include/postgres/access/rmgr.h +62 -0
- data/ext/pg_query/include/{access → postgres/access}/rmgrlist.h +24 -24
- data/ext/pg_query/include/{access → postgres/access}/sdir.h +12 -3
- data/ext/pg_query/include/{access → postgres/access}/skey.h +1 -1
- data/ext/pg_query/include/{access → postgres/access}/stratnum.h +4 -2
- data/ext/pg_query/include/{access → postgres/access}/sysattr.h +1 -1
- data/ext/pg_query/include/{access → postgres/access}/table.h +2 -1
- data/ext/pg_query/include/{access → postgres/access}/tableam.h +337 -62
- data/ext/pg_query/include/postgres/access/toast_compression.h +73 -0
- data/ext/pg_query/include/{access → postgres/access}/transam.h +123 -13
- data/ext/pg_query/include/postgres/access/tsmapi.h +82 -0
- data/ext/pg_query/include/{access → postgres/access}/tupconvert.h +5 -2
- data/ext/pg_query/include/{access → postgres/access}/tupdesc.h +2 -2
- data/ext/pg_query/include/{access → postgres/access}/tupmacs.h +60 -100
- data/ext/pg_query/include/{access → postgres/access}/twophase.h +5 -1
- data/ext/pg_query/include/{access → postgres/access}/xact.h +99 -32
- data/ext/pg_query/include/{access → postgres/access}/xlog.h +69 -165
- data/ext/pg_query/include/{access → postgres/access}/xlog_internal.h +147 -73
- data/ext/pg_query/include/postgres/access/xlogbackup.h +41 -0
- data/ext/pg_query/include/{access → postgres/access}/xlogdefs.h +13 -40
- data/ext/pg_query/include/postgres/access/xlogprefetcher.h +55 -0
- data/ext/pg_query/include/{access → postgres/access}/xlogreader.h +154 -37
- data/ext/pg_query/include/{access → postgres/access}/xlogrecord.h +34 -13
- data/ext/pg_query/include/postgres/access/xlogrecovery.h +158 -0
- data/ext/pg_query/include/postgres/archive/archive_module.h +59 -0
- data/ext/pg_query/include/{c.h → postgres/c.h} +245 -188
- data/ext/pg_query/include/{catalog → postgres/catalog}/catalog.h +6 -3
- data/ext/pg_query/include/{catalog → postgres/catalog}/catversion.h +6 -2
- data/ext/pg_query/include/{catalog → postgres/catalog}/dependency.h +14 -19
- data/ext/pg_query/include/postgres/catalog/genbki.h +143 -0
- data/ext/pg_query/include/{catalog → postgres/catalog}/index.h +20 -5
- data/ext/pg_query/include/postgres/catalog/indexing.h +54 -0
- data/ext/pg_query/include/{catalog → postgres/catalog}/namespace.h +5 -3
- data/ext/pg_query/include/{catalog → postgres/catalog}/objectaccess.h +73 -3
- data/ext/pg_query/include/{catalog → postgres/catalog}/objectaddress.h +12 -7
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_aggregate.h +14 -10
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_aggregate_d.h +2 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_am.h +4 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_am_d.h +3 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_attribute.h +45 -26
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_attribute_d.h +19 -16
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_authid.h +7 -2
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_authid_d.h +19 -9
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_class.h +45 -15
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_class_d.h +31 -2
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_collation.h +35 -8
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_collation_d.h +21 -3
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_constraint.h +39 -13
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_constraint_d.h +10 -4
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_control.h +13 -5
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_conversion.h +8 -5
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_conversion_d.h +4 -1
- data/ext/pg_query/include/postgres/catalog/pg_database.h +124 -0
- data/ext/pg_query/include/postgres/catalog/pg_database_d.h +52 -0
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_depend.h +11 -7
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_depend_d.h +3 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_event_trigger.h +9 -3
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_event_trigger_d.h +3 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_index.h +17 -7
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_index_d.h +20 -17
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_language.h +10 -5
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_language_d.h +3 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_namespace.h +7 -2
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_namespace_d.h +3 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_opclass.h +8 -5
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_opclass_d.h +3 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_operator.h +21 -16
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_operator_d.h +37 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_opfamily.h +8 -4
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_opfamily_d.h +6 -2
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_partitioned_table.h +20 -9
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_partitioned_table_d.h +2 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_proc.h +20 -11
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_proc_d.h +10 -8
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_publication.h +49 -6
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_publication_d.h +3 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_replication_origin.h +6 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_replication_origin_d.h +5 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_statistic.h +19 -12
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_statistic_d.h +2 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_statistic_ext.h +19 -5
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_statistic_ext_d.h +7 -2
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_transform.h +8 -5
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_transform_d.h +3 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_trigger.h +24 -8
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_trigger_d.h +4 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_ts_config.h +6 -3
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_ts_config_d.h +3 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_ts_dict.h +8 -3
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_ts_dict_d.h +3 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_ts_parser.h +6 -3
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_ts_parser_d.h +3 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_ts_template.h +6 -3
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_ts_template_d.h +3 -1
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_type.h +56 -24
- data/ext/pg_query/include/{catalog → postgres/catalog}/pg_type_d.h +70 -31
- data/ext/pg_query/include/{catalog → postgres/catalog}/storage.h +9 -7
- data/ext/pg_query/include/{commands → postgres/commands}/async.h +4 -5
- data/ext/pg_query/include/{commands → postgres/commands}/dbcommands.h +3 -1
- data/ext/pg_query/include/{commands → postgres/commands}/defrem.h +12 -24
- data/ext/pg_query/include/{commands → postgres/commands}/event_trigger.h +2 -2
- data/ext/pg_query/include/{commands → postgres/commands}/explain.h +3 -1
- data/ext/pg_query/include/{commands → postgres/commands}/prepare.h +1 -1
- data/ext/pg_query/include/{commands → postgres/commands}/tablespace.h +6 -4
- data/ext/pg_query/include/{commands → postgres/commands}/trigger.h +36 -25
- data/ext/pg_query/include/{commands → postgres/commands}/user.h +10 -4
- data/ext/pg_query/include/{commands → postgres/commands}/vacuum.h +140 -47
- data/ext/pg_query/include/postgres/common/cryptohash.h +39 -0
- data/ext/pg_query/include/{common → postgres/common}/file_perm.h +4 -4
- data/ext/pg_query/include/{common → postgres/common}/hashfn.h +1 -1
- data/ext/pg_query/include/postgres/common/int.h +437 -0
- data/ext/pg_query/include/{common → postgres/common}/keywords.h +2 -6
- data/ext/pg_query/include/{common → postgres/common}/kwlookup.h +2 -2
- data/ext/pg_query/include/postgres/common/pg_prng.h +61 -0
- data/ext/pg_query/include/{common → postgres/common}/relpath.h +21 -14
- data/ext/pg_query/include/postgres/common/scram-common.h +70 -0
- data/ext/pg_query/include/postgres/common/sha2.h +32 -0
- data/ext/pg_query/include/postgres/common/string.h +44 -0
- data/ext/pg_query/include/postgres/common/unicode_east_asian_fw_table.h +125 -0
- data/ext/pg_query/include/{common/unicode_combining_table.h → postgres/common/unicode_nonspacing_table.h} +138 -8
- data/ext/pg_query/include/postgres/copyfuncs.funcs.c +5013 -0
- data/ext/pg_query/include/postgres/copyfuncs.switch.c +938 -0
- data/ext/pg_query/include/{datatype → postgres/datatype}/timestamp.h +50 -4
- data/ext/pg_query/include/postgres/equalfuncs.funcs.c +3097 -0
- data/ext/pg_query/include/postgres/equalfuncs.switch.c +785 -0
- data/ext/pg_query/include/{executor → postgres/executor}/execdesc.h +1 -1
- data/ext/pg_query/include/{executor → postgres/executor}/executor.h +98 -32
- data/ext/pg_query/include/{executor → postgres/executor}/functions.h +17 -3
- data/ext/pg_query/include/{executor → postgres/executor}/instrument.h +33 -16
- data/ext/pg_query/include/{executor → postgres/executor}/spi.h +42 -4
- data/ext/pg_query/include/{executor → postgres/executor}/tablefunc.h +1 -1
- data/ext/pg_query/include/{executor → postgres/executor}/tuptable.h +18 -11
- data/ext/pg_query/include/{fmgr.h → postgres/fmgr.h} +33 -8
- data/ext/pg_query/include/postgres/foreign/fdwapi.h +294 -0
- data/ext/pg_query/include/{funcapi.h → postgres/funcapi.h} +22 -10
- data/ext/pg_query/include/postgres/gram.h +1127 -0
- data/ext/pg_query/include/{parser → postgres}/gramparse.h +4 -4
- data/ext/pg_query/include/{jit → postgres/jit}/jit.h +12 -12
- data/ext/pg_query/include/postgres/kwlist_d.h +1119 -0
- data/ext/pg_query/include/postgres/lib/dshash.h +115 -0
- data/ext/pg_query/include/{lib → postgres/lib}/ilist.h +454 -22
- data/ext/pg_query/include/{lib → postgres/lib}/pairingheap.h +1 -1
- data/ext/pg_query/include/{lib → postgres/lib}/simplehash.h +158 -33
- data/ext/pg_query/include/postgres/lib/sort_template.h +432 -0
- data/ext/pg_query/include/{lib → postgres/lib}/stringinfo.h +3 -3
- data/ext/pg_query/include/{libpq → postgres/libpq}/auth.h +12 -4
- data/ext/pg_query/include/{libpq → postgres/libpq}/crypt.h +5 -4
- data/ext/pg_query/include/{libpq → postgres/libpq}/hba.h +54 -8
- data/ext/pg_query/include/{libpq → postgres/libpq}/libpq-be.h +45 -17
- data/ext/pg_query/include/{libpq → postgres/libpq}/libpq.h +31 -20
- data/ext/pg_query/include/{libpq → postgres/libpq}/pqcomm.h +26 -71
- data/ext/pg_query/include/{libpq → postgres/libpq}/pqformat.h +2 -2
- data/ext/pg_query/include/{libpq → postgres/libpq}/pqsignal.h +25 -13
- data/ext/pg_query/include/postgres/libpq/sasl.h +136 -0
- data/ext/pg_query/include/postgres/libpq/scram.h +37 -0
- data/ext/pg_query/include/{mb → postgres/mb}/pg_wchar.h +125 -25
- data/ext/pg_query/include/{mb → postgres/mb}/stringinfo_mb.h +1 -1
- data/ext/pg_query/include/{miscadmin.h → postgres/miscadmin.h} +96 -65
- data/ext/pg_query/include/{nodes → postgres/nodes}/bitmapset.h +11 -7
- data/ext/pg_query/include/{nodes → postgres/nodes}/execnodes.h +351 -103
- data/ext/pg_query/include/{nodes → postgres/nodes}/extensible.h +8 -4
- data/ext/pg_query/include/{nodes → postgres/nodes}/lockoptions.h +1 -1
- data/ext/pg_query/include/{nodes → postgres/nodes}/makefuncs.h +19 -6
- data/ext/pg_query/include/{nodes → postgres/nodes}/memnodes.h +11 -6
- data/ext/pg_query/include/postgres/nodes/miscnodes.h +56 -0
- data/ext/pg_query/include/{nodes → postgres/nodes}/nodeFuncs.h +89 -29
- data/ext/pg_query/include/{nodes → postgres/nodes}/nodes.h +100 -496
- data/ext/pg_query/include/postgres/nodes/nodetags.h +471 -0
- data/ext/pg_query/include/{nodes → postgres/nodes}/params.h +3 -3
- data/ext/pg_query/include/{nodes → postgres/nodes}/parsenodes.h +678 -207
- data/ext/pg_query/include/{nodes → postgres/nodes}/pathnodes.h +1282 -454
- data/ext/pg_query/include/{nodes → postgres/nodes}/pg_list.h +103 -73
- data/ext/pg_query/include/{nodes → postgres/nodes}/plannodes.h +474 -133
- data/ext/pg_query/include/{nodes → postgres/nodes}/primnodes.h +754 -254
- data/ext/pg_query/include/{nodes → postgres/nodes}/print.h +1 -1
- data/ext/pg_query/include/postgres/nodes/queryjumble.h +86 -0
- data/ext/pg_query/include/postgres/nodes/replnodes.h +111 -0
- data/ext/pg_query/include/postgres/nodes/supportnodes.h +346 -0
- data/ext/pg_query/include/{nodes → postgres/nodes}/tidbitmap.h +1 -1
- data/ext/pg_query/include/postgres/nodes/value.h +90 -0
- data/ext/pg_query/include/{optimizer → postgres/optimizer}/cost.h +14 -5
- data/ext/pg_query/include/{optimizer → postgres/optimizer}/geqo.h +9 -7
- data/ext/pg_query/include/{optimizer → postgres/optimizer}/geqo_gene.h +1 -1
- data/ext/pg_query/include/{optimizer → postgres/optimizer}/optimizer.h +31 -28
- data/ext/pg_query/include/{optimizer → postgres/optimizer}/paths.h +29 -12
- data/ext/pg_query/include/{optimizer → postgres/optimizer}/planmain.h +15 -17
- data/ext/pg_query/include/{parser → postgres/parser}/analyze.h +20 -5
- data/ext/pg_query/include/postgres/parser/kwlist.h +498 -0
- data/ext/pg_query/include/{parser → postgres/parser}/parse_agg.h +5 -8
- data/ext/pg_query/include/{parser → postgres/parser}/parse_coerce.h +6 -1
- data/ext/pg_query/include/{parser → postgres/parser}/parse_expr.h +2 -3
- data/ext/pg_query/include/{parser → postgres/parser}/parse_func.h +2 -1
- data/ext/pg_query/include/{parser → postgres/parser}/parse_node.h +41 -11
- data/ext/pg_query/include/{parser → postgres/parser}/parse_oper.h +3 -5
- data/ext/pg_query/include/{parser → postgres/parser}/parse_relation.h +11 -5
- data/ext/pg_query/include/{parser → postgres/parser}/parse_type.h +4 -3
- data/ext/pg_query/include/postgres/parser/parser.h +68 -0
- data/ext/pg_query/include/{parser → postgres/parser}/parsetree.h +1 -1
- data/ext/pg_query/include/{parser → postgres/parser}/scanner.h +2 -2
- data/ext/pg_query/include/{parser → postgres/parser}/scansup.h +2 -5
- data/ext/pg_query/include/{partitioning → postgres/partitioning}/partdefs.h +1 -1
- data/ext/pg_query/include/{pg_config.h → postgres/pg_config.h} +216 -228
- data/ext/pg_query/include/{pg_config_manual.h → postgres/pg_config_manual.h} +80 -58
- data/ext/pg_query/include/postgres/pg_config_os.h +8 -0
- data/ext/pg_query/include/{pg_getopt.h → postgres/pg_getopt.h} +6 -6
- data/ext/pg_query/include/{pg_trace.h → postgres/pg_trace.h} +1 -1
- data/ext/pg_query/include/postgres/pgstat.h +778 -0
- data/ext/pg_query/include/{pgtime.h → postgres/pgtime.h} +16 -6
- data/ext/pg_query/include/{pl_gram.h → postgres/pl_gram.h} +116 -116
- data/ext/pg_query/include/{pl_reserved_kwlist.h → postgres/pl_reserved_kwlist.h} +1 -1
- data/ext/pg_query/include/{pl_reserved_kwlist_d.h → postgres/pl_reserved_kwlist_d.h} +10 -10
- data/ext/pg_query/include/{pl_unreserved_kwlist.h → postgres/pl_unreserved_kwlist.h} +3 -3
- data/ext/pg_query/include/{pl_unreserved_kwlist_d.h → postgres/pl_unreserved_kwlist_d.h} +60 -60
- data/ext/pg_query/include/{plerrcodes.h → postgres/plerrcodes.h} +9 -1
- data/ext/pg_query/include/{plpgsql.h → postgres/plpgsql.h} +79 -86
- data/ext/pg_query/include/{port → postgres/port}/atomics/arch-arm.h +9 -3
- data/ext/pg_query/include/postgres/port/atomics/arch-hppa.h +17 -0
- data/ext/pg_query/include/{port → postgres/port}/atomics/arch-ppc.h +21 -21
- data/ext/pg_query/include/{port → postgres/port}/atomics/arch-x86.h +2 -2
- data/ext/pg_query/include/{port → postgres/port}/atomics/fallback.h +3 -3
- data/ext/pg_query/include/{port → postgres/port}/atomics/generic-gcc.h +3 -3
- data/ext/pg_query/include/postgres/port/atomics/generic-msvc.h +101 -0
- data/ext/pg_query/include/postgres/port/atomics/generic-sunpro.h +106 -0
- data/ext/pg_query/include/{port → postgres/port}/atomics/generic.h +1 -1
- data/ext/pg_query/include/{port → postgres/port}/atomics.h +2 -7
- data/ext/pg_query/include/{port → postgres/port}/pg_bitutils.h +129 -16
- data/ext/pg_query/include/{port → postgres/port}/pg_bswap.h +1 -1
- data/ext/pg_query/include/{port → postgres/port}/pg_crc32c.h +1 -1
- data/ext/pg_query/include/postgres/port/simd.h +375 -0
- data/ext/pg_query/include/postgres/port/win32/arpa/inet.h +3 -0
- data/ext/pg_query/include/postgres/port/win32/dlfcn.h +1 -0
- data/ext/pg_query/include/postgres/port/win32/grp.h +1 -0
- data/ext/pg_query/include/postgres/port/win32/netdb.h +7 -0
- data/ext/pg_query/include/postgres/port/win32/netinet/in.h +3 -0
- data/ext/pg_query/include/postgres/port/win32/netinet/tcp.h +7 -0
- data/ext/pg_query/include/postgres/port/win32/pwd.h +3 -0
- data/ext/pg_query/include/postgres/port/win32/sys/resource.h +20 -0
- data/ext/pg_query/include/postgres/port/win32/sys/select.h +3 -0
- data/ext/pg_query/include/postgres/port/win32/sys/socket.h +26 -0
- data/ext/pg_query/include/postgres/port/win32/sys/un.h +17 -0
- data/ext/pg_query/include/postgres/port/win32/sys/wait.h +3 -0
- data/ext/pg_query/include/postgres/port/win32.h +59 -0
- data/ext/pg_query/include/postgres/port/win32_msvc/dirent.h +34 -0
- data/ext/pg_query/include/postgres/port/win32_msvc/sys/file.h +1 -0
- data/ext/pg_query/include/postgres/port/win32_msvc/sys/param.h +1 -0
- data/ext/pg_query/include/postgres/port/win32_msvc/sys/time.h +1 -0
- data/ext/pg_query/include/postgres/port/win32_msvc/unistd.h +9 -0
- data/ext/pg_query/include/postgres/port/win32_msvc/utime.h +3 -0
- data/ext/pg_query/include/postgres/port/win32_port.h +594 -0
- data/ext/pg_query/include/{port.h → postgres/port.h} +107 -111
- data/ext/pg_query/include/postgres/portability/instr_time.h +197 -0
- data/ext/pg_query/include/postgres/postgres.h +579 -0
- data/ext/pg_query/include/{postgres_ext.h → postgres/postgres_ext.h} +0 -1
- data/ext/pg_query/include/{postmaster → postgres/postmaster}/autovacuum.h +17 -20
- data/ext/pg_query/include/{postmaster → postgres/postmaster}/bgworker.h +3 -2
- data/ext/pg_query/include/{postmaster → postgres/postmaster}/bgworker_internals.h +2 -2
- data/ext/pg_query/include/{postmaster → postgres/postmaster}/bgwriter.h +6 -6
- data/ext/pg_query/include/{postmaster → postgres/postmaster}/interrupt.h +1 -1
- data/ext/pg_query/include/{postmaster → postgres/postmaster}/pgarch.h +7 -10
- data/ext/pg_query/include/{postmaster → postgres/postmaster}/postmaster.h +21 -17
- data/ext/pg_query/include/postgres/postmaster/startup.h +41 -0
- data/ext/pg_query/include/{postmaster → postgres/postmaster}/syslogger.h +16 -11
- data/ext/pg_query/include/{postmaster → postgres/postmaster}/walwriter.h +5 -3
- data/ext/pg_query/include/{regex → postgres/regex}/regex.h +27 -22
- data/ext/pg_query/include/{replication → postgres/replication}/logicallauncher.h +8 -5
- data/ext/pg_query/include/postgres/replication/logicalproto.h +274 -0
- data/ext/pg_query/include/postgres/replication/logicalworker.h +32 -0
- data/ext/pg_query/include/{replication → postgres/replication}/origin.h +8 -8
- data/ext/pg_query/include/postgres/replication/reorderbuffer.h +753 -0
- data/ext/pg_query/include/{replication → postgres/replication}/slot.h +42 -12
- data/ext/pg_query/include/{replication → postgres/replication}/syncrep.h +6 -12
- data/ext/pg_query/include/{replication → postgres/replication}/walreceiver.h +158 -20
- data/ext/pg_query/include/{replication → postgres/replication}/walsender.h +20 -20
- data/ext/pg_query/include/{rewrite → postgres/rewrite}/prs2lock.h +1 -1
- data/ext/pg_query/include/{rewrite → postgres/rewrite}/rewriteHandler.h +1 -6
- data/ext/pg_query/include/{rewrite → postgres/rewrite}/rewriteManip.h +11 -2
- data/ext/pg_query/include/{rewrite → postgres/rewrite}/rewriteSupport.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/backendid.h +3 -3
- data/ext/pg_query/include/{storage → postgres/storage}/block.h +24 -37
- data/ext/pg_query/include/{storage → postgres/storage}/buf.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/bufmgr.h +196 -95
- data/ext/pg_query/include/{storage → postgres/storage}/bufpage.h +152 -101
- data/ext/pg_query/include/{storage → postgres/storage}/condition_variable.h +14 -3
- data/ext/pg_query/include/{storage → postgres/storage}/dsm.h +6 -6
- data/ext/pg_query/include/{storage → postgres/storage}/dsm_impl.h +6 -2
- data/ext/pg_query/include/{storage → postgres/storage}/fd.h +48 -14
- data/ext/pg_query/include/postgres/storage/fileset.h +40 -0
- data/ext/pg_query/include/{storage → postgres/storage}/ipc.h +5 -2
- data/ext/pg_query/include/{storage → postgres/storage}/item.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/itemid.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/itemptr.h +96 -57
- data/ext/pg_query/include/{storage → postgres/storage}/large_object.h +2 -2
- data/ext/pg_query/include/{storage → postgres/storage}/latch.h +17 -13
- data/ext/pg_query/include/{storage → postgres/storage}/lmgr.h +7 -1
- data/ext/pg_query/include/{storage → postgres/storage}/lock.h +37 -25
- data/ext/pg_query/include/{storage → postgres/storage}/lockdefs.h +4 -4
- data/ext/pg_query/include/{storage → postgres/storage}/lwlock.h +21 -33
- data/ext/pg_query/include/{storage → postgres/storage}/lwlocknames.h +0 -1
- data/ext/pg_query/include/{storage → postgres/storage}/off.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/pg_sema.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/pg_shmem.h +9 -7
- data/ext/pg_query/include/{storage → postgres/storage}/pmsignal.h +15 -4
- data/ext/pg_query/include/{storage → postgres/storage}/predicate.h +5 -5
- data/ext/pg_query/include/{storage → postgres/storage}/proc.h +200 -67
- data/ext/pg_query/include/postgres/storage/procarray.h +99 -0
- data/ext/pg_query/include/{storage → postgres/storage}/proclist_types.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/procsignal.h +5 -7
- data/ext/pg_query/include/postgres/storage/relfilelocator.h +99 -0
- data/ext/pg_query/include/{storage → postgres/storage}/s_lock.h +118 -298
- data/ext/pg_query/include/{storage → postgres/storage}/sharedfileset.h +3 -11
- data/ext/pg_query/include/{storage → postgres/storage}/shm_mq.h +5 -4
- data/ext/pg_query/include/{storage → postgres/storage}/shm_toc.h +1 -1
- data/ext/pg_query/include/{storage → postgres/storage}/shmem.h +1 -23
- data/ext/pg_query/include/{storage → postgres/storage}/sinval.h +5 -5
- data/ext/pg_query/include/{storage → postgres/storage}/sinvaladt.h +4 -2
- data/ext/pg_query/include/{storage → postgres/storage}/smgr.h +21 -17
- data/ext/pg_query/include/{storage → postgres/storage}/spin.h +2 -2
- data/ext/pg_query/include/{storage → postgres/storage}/standby.h +17 -9
- data/ext/pg_query/include/{storage → postgres/storage}/standbydefs.h +2 -2
- data/ext/pg_query/include/{storage → postgres/storage}/sync.h +9 -5
- data/ext/pg_query/include/{tcop → postgres/tcop}/cmdtag.h +7 -2
- data/ext/pg_query/include/{tcop → postgres/tcop}/cmdtaglist.h +3 -2
- data/ext/pg_query/include/{tcop → postgres/tcop}/deparse_utility.h +1 -1
- data/ext/pg_query/include/{tcop → postgres/tcop}/dest.h +1 -3
- data/ext/pg_query/include/{tcop → postgres/tcop}/fastpath.h +1 -2
- data/ext/pg_query/include/{tcop → postgres/tcop}/pquery.h +7 -1
- data/ext/pg_query/include/{tcop → postgres/tcop}/tcopprot.h +19 -14
- data/ext/pg_query/include/{tcop → postgres/tcop}/utility.h +7 -3
- data/ext/pg_query/include/{tsearch → postgres/tsearch}/ts_cache.h +3 -5
- data/ext/pg_query/include/{utils → postgres/utils}/acl.h +37 -71
- data/ext/pg_query/include/{utils → postgres/utils}/aclchk_internal.h +1 -1
- data/ext/pg_query/include/{utils → postgres/utils}/array.h +26 -2
- data/ext/pg_query/include/postgres/utils/backend_progress.h +45 -0
- data/ext/pg_query/include/postgres/utils/backend_status.h +342 -0
- data/ext/pg_query/include/{utils → postgres/utils}/builtins.h +20 -11
- data/ext/pg_query/include/{utils → postgres/utils}/bytea.h +3 -2
- data/ext/pg_query/include/{utils → postgres/utils}/catcache.h +1 -1
- data/ext/pg_query/include/{utils → postgres/utils}/date.h +37 -9
- data/ext/pg_query/include/{utils → postgres/utils}/datetime.h +48 -27
- data/ext/pg_query/include/{utils → postgres/utils}/datum.h +9 -1
- data/ext/pg_query/include/{utils → postgres/utils}/dsa.h +5 -1
- data/ext/pg_query/include/{utils → postgres/utils}/elog.h +154 -48
- data/ext/pg_query/include/{utils → postgres/utils}/errcodes.h +2 -0
- data/ext/pg_query/include/{utils → postgres/utils}/expandeddatum.h +14 -3
- data/ext/pg_query/include/{utils → postgres/utils}/expandedrecord.h +14 -4
- data/ext/pg_query/include/{utils → postgres/utils}/float.h +13 -12
- data/ext/pg_query/include/{utils → postgres/utils}/fmgroids.h +1353 -696
- data/ext/pg_query/include/{utils → postgres/utils}/fmgrprotos.h +243 -18
- data/ext/pg_query/include/{utils → postgres/utils}/fmgrtab.h +6 -5
- data/ext/pg_query/include/{utils → postgres/utils}/guc.h +120 -121
- data/ext/pg_query/include/postgres/utils/guc_hooks.h +163 -0
- data/ext/pg_query/include/{utils → postgres/utils}/guc_tables.h +71 -21
- data/ext/pg_query/include/{utils → postgres/utils}/hsearch.h +15 -11
- data/ext/pg_query/include/{utils → postgres/utils}/inval.h +7 -3
- data/ext/pg_query/include/postgres/utils/logtape.h +77 -0
- data/ext/pg_query/include/{utils → postgres/utils}/lsyscache.h +16 -1
- data/ext/pg_query/include/{utils → postgres/utils}/memdebug.h +1 -1
- data/ext/pg_query/include/{utils → postgres/utils}/memutils.h +14 -53
- data/ext/pg_query/include/postgres/utils/memutils_internal.h +136 -0
- data/ext/pg_query/include/postgres/utils/memutils_memorychunk.h +237 -0
- data/ext/pg_query/include/{utils → postgres/utils}/numeric.h +38 -9
- data/ext/pg_query/include/{utils → postgres/utils}/palloc.h +33 -4
- data/ext/pg_query/include/{utils → postgres/utils}/partcache.h +3 -2
- data/ext/pg_query/include/{utils → postgres/utils}/pg_locale.h +37 -21
- data/ext/pg_query/include/postgres/utils/pgstat_internal.h +814 -0
- data/ext/pg_query/include/{utils → postgres/utils}/plancache.h +6 -5
- data/ext/pg_query/include/{utils → postgres/utils}/portal.h +12 -1
- data/ext/pg_query/include/{utils → postgres/utils}/probes.h +59 -59
- data/ext/pg_query/include/postgres/utils/ps_status.h +47 -0
- data/ext/pg_query/include/{utils → postgres/utils}/queryenvironment.h +1 -1
- data/ext/pg_query/include/postgres/utils/regproc.h +39 -0
- data/ext/pg_query/include/{utils → postgres/utils}/rel.h +129 -61
- data/ext/pg_query/include/{utils → postgres/utils}/relcache.h +21 -14
- data/ext/pg_query/include/{utils → postgres/utils}/reltrigger.h +1 -1
- data/ext/pg_query/include/{utils → postgres/utils}/resowner.h +1 -1
- data/ext/pg_query/include/{utils → postgres/utils}/ruleutils.h +9 -1
- data/ext/pg_query/include/{utils → postgres/utils}/sharedtuplestore.h +1 -1
- data/ext/pg_query/include/{utils → postgres/utils}/snapmgr.h +38 -15
- data/ext/pg_query/include/{utils → postgres/utils}/snapshot.h +14 -1
- data/ext/pg_query/include/{utils → postgres/utils}/sortsupport.h +117 -2
- data/ext/pg_query/include/{utils → postgres/utils}/syscache.h +9 -1
- data/ext/pg_query/include/{utils → postgres/utils}/timeout.h +11 -4
- data/ext/pg_query/include/{utils → postgres/utils}/timestamp.h +46 -15
- data/ext/pg_query/include/{utils → postgres/utils}/tuplesort.h +209 -41
- data/ext/pg_query/include/{utils → postgres/utils}/tuplestore.h +2 -2
- data/ext/pg_query/include/{utils → postgres/utils}/typcache.h +24 -17
- data/ext/pg_query/include/{utils → postgres/utils}/varlena.h +17 -3
- data/ext/pg_query/include/postgres/utils/wait_event.h +294 -0
- data/ext/pg_query/include/{utils → postgres/utils}/xml.h +18 -8
- data/ext/pg_query/include/{postgres.h → postgres/varatt.h} +65 -471
- data/ext/pg_query/include/protobuf/pg_query.pb-c.h +7494 -6382
- data/ext/pg_query/include/protobuf/pg_query.pb.h +116922 -84792
- data/ext/pg_query/include/protobuf-c/protobuf-c.h +7 -3
- data/ext/pg_query/include/protobuf-c.h +7 -3
- data/ext/pg_query/pg_query.c +10 -1
- data/ext/pg_query/pg_query.pb-c.c +21026 -17002
- data/ext/pg_query/pg_query_deparse.c +1 -9896
- data/ext/pg_query/pg_query_fingerprint.c +162 -50
- data/ext/pg_query/pg_query_fingerprint.h +3 -1
- data/ext/pg_query/pg_query_internal.h +1 -1
- data/ext/pg_query/pg_query_json_plpgsql.c +56 -12
- data/ext/pg_query/pg_query_normalize.c +259 -64
- data/ext/pg_query/pg_query_outfuncs.h +1 -0
- data/ext/pg_query/pg_query_outfuncs_json.c +71 -16
- data/ext/pg_query/pg_query_outfuncs_protobuf.c +73 -12
- data/ext/pg_query/pg_query_parse.c +47 -5
- data/ext/pg_query/pg_query_parse_plpgsql.c +86 -21
- data/ext/pg_query/pg_query_readfuncs_protobuf.c +43 -8
- data/ext/pg_query/pg_query_ruby.c +6 -1
- data/ext/pg_query/pg_query_ruby_freebsd.sym +2 -0
- data/ext/pg_query/pg_query_scan.c +3 -2
- data/ext/pg_query/pg_query_split.c +6 -5
- data/ext/pg_query/postgres_deparse.c +11067 -0
- data/ext/pg_query/postgres_deparse.h +9 -0
- data/ext/pg_query/protobuf-c.c +34 -27
- data/ext/pg_query/src_backend_catalog_namespace.c +27 -10
- data/ext/pg_query/src_backend_catalog_pg_proc.c +4 -1
- data/ext/pg_query/src_backend_commands_define.c +11 -1
- data/ext/pg_query/src_backend_nodes_bitmapset.c +13 -70
- data/ext/pg_query/src_backend_nodes_copyfuncs.c +103 -5894
- data/ext/pg_query/src_backend_nodes_equalfuncs.c +102 -3830
- data/ext/pg_query/src_backend_nodes_extensible.c +6 -29
- data/ext/pg_query/src_backend_nodes_list.c +99 -12
- data/ext/pg_query/src_backend_nodes_makefuncs.c +99 -4
- data/ext/pg_query/src_backend_nodes_nodeFuncs.c +325 -131
- data/ext/pg_query/src_backend_nodes_nodes.c +38 -0
- data/ext/pg_query/src_backend_nodes_value.c +28 -19
- data/ext/pg_query/src_backend_parser_gram.c +36104 -32074
- data/ext/pg_query/src_backend_parser_parser.c +53 -8
- data/ext/pg_query/src_backend_parser_scan.c +4893 -3701
- data/ext/pg_query/src_backend_parser_scansup.c +4 -28
- data/ext/pg_query/src_backend_storage_ipc_ipc.c +13 -4
- data/ext/pg_query/src_backend_tcop_postgres.c +133 -105
- data/ext/pg_query/src_backend_utils_activity_pgstat_database.c +140 -0
- data/ext/pg_query/src_backend_utils_adt_datum.c +17 -7
- data/ext/pg_query/src_backend_utils_adt_expandeddatum.c +1 -1
- data/ext/pg_query/src_backend_utils_adt_format_type.c +6 -2
- data/ext/pg_query/src_backend_utils_adt_numutils.c +489 -0
- data/ext/pg_query/src_backend_utils_adt_ruleutils.c +187 -19
- data/ext/pg_query/src_backend_utils_error_assert.c +17 -18
- data/ext/pg_query/src_backend_utils_error_elog.c +513 -318
- data/ext/pg_query/src_backend_utils_fmgr_fmgr.c +44 -17
- data/ext/pg_query/src_backend_utils_init_globals.c +9 -6
- data/ext/pg_query/src_backend_utils_mb_mbutils.c +74 -131
- data/ext/pg_query/src_backend_utils_misc_guc_tables.c +492 -0
- data/ext/pg_query/src_backend_utils_mmgr_alignedalloc.c +163 -0
- data/ext/pg_query/src_backend_utils_mmgr_aset.c +453 -314
- data/ext/pg_query/src_backend_utils_mmgr_generation.c +1039 -0
- data/ext/pg_query/src_backend_utils_mmgr_mcxt.c +549 -76
- data/ext/pg_query/src_backend_utils_mmgr_slab.c +1021 -0
- data/ext/pg_query/src_common_encnames.c +4 -1
- data/ext/pg_query/src_common_hashfn.c +420 -0
- data/ext/pg_query/src_common_keywords.c +15 -2
- data/ext/pg_query/src_common_kwlist_d.h +545 -498
- data/ext/pg_query/src_common_kwlookup.c +1 -1
- data/ext/pg_query/src_common_psprintf.c +1 -1
- data/ext/pg_query/src_common_stringinfo.c +4 -4
- data/ext/pg_query/src_common_wchar.c +717 -113
- data/ext/pg_query/src_pl_plpgsql_src_pl_comp.c +49 -22
- data/ext/pg_query/src_pl_plpgsql_src_pl_funcs.c +3 -18
- data/ext/pg_query/src_pl_plpgsql_src_pl_gram.c +1136 -1195
- data/ext/pg_query/src_pl_plpgsql_src_pl_handler.c +1 -1
- data/ext/pg_query/src_pl_plpgsql_src_pl_reserved_kwlist_d.h +10 -10
- data/ext/pg_query/src_pl_plpgsql_src_pl_scanner.c +2 -2
- data/ext/pg_query/src_pl_plpgsql_src_pl_unreserved_kwlist_d.h +60 -60
- data/ext/pg_query/src_port_pg_bitutils.c +103 -40
- data/ext/pg_query/src_port_pgstrcasecmp.c +29 -1
- data/ext/pg_query/src_port_qsort.c +12 -224
- data/ext/pg_query/src_port_snprintf.c +51 -29
- data/ext/pg_query/src_port_strerror.c +9 -19
- data/ext/pg_query/src_port_strlcpy.c +79 -0
- data/lib/pg_query/deparse.rb +7 -1
- data/lib/pg_query/filter_columns.rb +7 -5
- data/lib/pg_query/fingerprint.rb +21 -9
- data/lib/pg_query/node.rb +18 -13
- data/lib/pg_query/param_refs.rb +1 -1
- data/lib/pg_query/parse.rb +141 -50
- data/lib/pg_query/pg_query_pb.rb +175 -3031
- data/lib/pg_query/treewalker.rb +26 -2
- data/lib/pg_query/truncate.rb +54 -8
- data/lib/pg_query/version.rb +1 -1
- data/lib/pg_query.rb +0 -1
- metadata +443 -380
- data/ext/pg_query/guc-file.c +0 -0
- data/ext/pg_query/include/access/rmgr.h +0 -35
- data/ext/pg_query/include/access/xloginsert.h +0 -64
- data/ext/pg_query/include/bootstrap/bootstrap.h +0 -62
- data/ext/pg_query/include/catalog/genbki.h +0 -64
- data/ext/pg_query/include/catalog/indexing.h +0 -366
- data/ext/pg_query/include/commands/variable.h +0 -38
- data/ext/pg_query/include/common/ip.h +0 -37
- data/ext/pg_query/include/common/string.h +0 -19
- data/ext/pg_query/include/getaddrinfo.h +0 -162
- data/ext/pg_query/include/kwlist_d.h +0 -1072
- data/ext/pg_query/include/nodes/value.h +0 -61
- data/ext/pg_query/include/parser/gram.h +0 -1067
- data/ext/pg_query/include/parser/kwlist.h +0 -477
- data/ext/pg_query/include/parser/parse_clause.h +0 -54
- data/ext/pg_query/include/parser/parse_collate.h +0 -27
- data/ext/pg_query/include/parser/parse_target.h +0 -46
- data/ext/pg_query/include/parser/parser.h +0 -41
- data/ext/pg_query/include/pg_config_os.h +0 -8
- data/ext/pg_query/include/pgstat.h +0 -1487
- data/ext/pg_query/include/portability/instr_time.h +0 -256
- data/ext/pg_query/include/postmaster/fork_process.h +0 -17
- data/ext/pg_query/include/replication/logicalproto.h +0 -110
- data/ext/pg_query/include/replication/logicalworker.h +0 -19
- data/ext/pg_query/include/replication/reorderbuffer.h +0 -467
- data/ext/pg_query/include/storage/relfilenode.h +0 -99
- data/ext/pg_query/include/utils/dynahash.h +0 -19
- data/ext/pg_query/include/utils/pg_lsn.h +0 -29
- data/ext/pg_query/include/utils/pidfile.h +0 -56
- data/ext/pg_query/include/utils/ps_status.h +0 -25
- data/ext/pg_query/include/utils/regproc.h +0 -28
- data/ext/pg_query/include/utils/rls.h +0 -50
- data/ext/pg_query/include/utils/tzparser.h +0 -39
- data/ext/pg_query/src_backend_libpq_pqcomm.c +0 -651
- data/ext/pg_query/src_backend_parser_parse_expr.c +0 -313
- data/ext/pg_query/src_backend_postmaster_postmaster.c +0 -2230
- data/ext/pg_query/src_backend_storage_lmgr_s_lock.c +0 -370
- data/ext/pg_query/src_backend_utils_hash_dynahash.c +0 -1086
- data/ext/pg_query/src_backend_utils_misc_guc.c +0 -1831
- data/ext/pg_query/src_common_string.c +0 -86
- data/ext/pg_query/src_port_erand48.c +0 -127
- data/ext/pg_query/src_port_pgsleep.c +0 -69
- data/ext/pg_query/src_port_random.c +0 -31
- data/ext/pg_query/src_port_strnlen.c +0 -39
- data/lib/pg_query/json_field_names.rb +0 -1402
- /data/ext/pg_query/include/{pg_config_ext.h → postgres/pg_config_ext.h} +0 -0
@@ -12,7 +12,7 @@
|
|
12
12
|
* identifying statement boundaries in multi-statement source strings.
|
13
13
|
*
|
14
14
|
*
|
15
|
-
* Portions Copyright (c) 1996-
|
15
|
+
* Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
|
16
16
|
* Portions Copyright (c) 1994, Regents of the University of California
|
17
17
|
*
|
18
18
|
* src/include/nodes/parsenodes.h
|
@@ -22,6 +22,7 @@
|
|
22
22
|
#ifndef PARSENODES_H
|
23
23
|
#define PARSENODES_H
|
24
24
|
|
25
|
+
#include "common/relpath.h"
|
25
26
|
#include "nodes/bitmapset.h"
|
26
27
|
#include "nodes/lockoptions.h"
|
27
28
|
#include "nodes/primnodes.h"
|
@@ -62,14 +63,22 @@ typedef enum SortByNulls
|
|
62
63
|
SORTBY_NULLS_LAST
|
63
64
|
} SortByNulls;
|
64
65
|
|
66
|
+
/* Options for [ ALL | DISTINCT ] */
|
67
|
+
typedef enum SetQuantifier
|
68
|
+
{
|
69
|
+
SET_QUANTIFIER_DEFAULT,
|
70
|
+
SET_QUANTIFIER_ALL,
|
71
|
+
SET_QUANTIFIER_DISTINCT
|
72
|
+
} SetQuantifier;
|
73
|
+
|
65
74
|
/*
|
66
75
|
* Grantable rights are encoded so that we can OR them together in a bitmask.
|
67
|
-
* The present representation of AclItem limits us to
|
68
|
-
* even though AclMode is defined as
|
76
|
+
* The present representation of AclItem limits us to 32 distinct rights,
|
77
|
+
* even though AclMode is defined as uint64. See utils/acl.h.
|
69
78
|
*
|
70
79
|
* Caution: changing these codes breaks stored ACLs, hence forces initdb.
|
71
80
|
*/
|
72
|
-
typedef
|
81
|
+
typedef uint64 AclMode; /* a bitmask of privilege bits */
|
73
82
|
|
74
83
|
#define ACL_INSERT (1<<0) /* for relations */
|
75
84
|
#define ACL_SELECT (1<<1)
|
@@ -79,12 +88,13 @@ typedef uint32 AclMode; /* a bitmask of privilege bits */
|
|
79
88
|
#define ACL_REFERENCES (1<<5)
|
80
89
|
#define ACL_TRIGGER (1<<6)
|
81
90
|
#define ACL_EXECUTE (1<<7) /* for functions */
|
82
|
-
#define ACL_USAGE (1<<8) /* for
|
83
|
-
* servers */
|
91
|
+
#define ACL_USAGE (1<<8) /* for various object types */
|
84
92
|
#define ACL_CREATE (1<<9) /* for namespaces and databases */
|
85
93
|
#define ACL_CREATE_TEMP (1<<10) /* for databases */
|
86
94
|
#define ACL_CONNECT (1<<11) /* for databases */
|
87
|
-
#define
|
95
|
+
#define ACL_SET (1<<12) /* for configuration parameters */
|
96
|
+
#define ACL_ALTER_SYSTEM (1<<13) /* for configuration parameters */
|
97
|
+
#define N_ACL_RIGHTS 14 /* 1 plus the last 1<<x */
|
88
98
|
#define ACL_NO_RIGHTS 0
|
89
99
|
/* Currently, SELECT ... FOR [KEY] UPDATE/SHARE requires UPDATE privileges */
|
90
100
|
#define ACL_SELECT_FOR_UPDATE ACL_UPDATE
|
@@ -104,48 +114,88 @@ typedef uint32 AclMode; /* a bitmask of privilege bits */
|
|
104
114
|
*
|
105
115
|
* Planning converts a Query tree into a Plan tree headed by a PlannedStmt
|
106
116
|
* node --- the Query structure is not used by the executor.
|
117
|
+
*
|
118
|
+
* All the fields ignored for the query jumbling are not semantically
|
119
|
+
* significant (such as alias names), as is ignored anything that can
|
120
|
+
* be deduced from child nodes (else we'd just be double-hashing that
|
121
|
+
* piece of information).
|
107
122
|
*/
|
108
123
|
typedef struct Query
|
109
124
|
{
|
110
125
|
NodeTag type;
|
111
126
|
|
112
|
-
CmdType commandType; /* select|insert|update|delete|utility */
|
127
|
+
CmdType commandType; /* select|insert|update|delete|merge|utility */
|
113
128
|
|
114
|
-
|
129
|
+
/* where did I come from? */
|
130
|
+
QuerySource querySource pg_node_attr(query_jumble_ignore);
|
115
131
|
|
116
|
-
|
132
|
+
/*
|
133
|
+
* query identifier (can be set by plugins); ignored for equal, as it
|
134
|
+
* might not be set; also not stored. This is the result of the query
|
135
|
+
* jumble, hence ignored.
|
136
|
+
*/
|
137
|
+
uint64 queryId pg_node_attr(equal_ignore, query_jumble_ignore, read_write_ignore, read_as(0));
|
117
138
|
|
118
|
-
|
139
|
+
/* do I set the command result tag? */
|
140
|
+
bool canSetTag pg_node_attr(query_jumble_ignore);
|
119
141
|
|
120
142
|
Node *utilityStmt; /* non-null if commandType == CMD_UTILITY */
|
121
143
|
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
bool
|
131
|
-
|
132
|
-
bool
|
133
|
-
|
144
|
+
/*
|
145
|
+
* rtable index of target relation for INSERT/UPDATE/DELETE/MERGE; 0 for
|
146
|
+
* SELECT. This is ignored in the query jumble as unrelated to the
|
147
|
+
* compilation of the query ID.
|
148
|
+
*/
|
149
|
+
int resultRelation pg_node_attr(query_jumble_ignore);
|
150
|
+
|
151
|
+
/* has aggregates in tlist or havingQual */
|
152
|
+
bool hasAggs pg_node_attr(query_jumble_ignore);
|
153
|
+
/* has window functions in tlist */
|
154
|
+
bool hasWindowFuncs pg_node_attr(query_jumble_ignore);
|
155
|
+
/* has set-returning functions in tlist */
|
156
|
+
bool hasTargetSRFs pg_node_attr(query_jumble_ignore);
|
157
|
+
/* has subquery SubLink */
|
158
|
+
bool hasSubLinks pg_node_attr(query_jumble_ignore);
|
159
|
+
/* distinctClause is from DISTINCT ON */
|
160
|
+
bool hasDistinctOn pg_node_attr(query_jumble_ignore);
|
161
|
+
/* WITH RECURSIVE was specified */
|
162
|
+
bool hasRecursive pg_node_attr(query_jumble_ignore);
|
163
|
+
/* has INSERT/UPDATE/DELETE in WITH */
|
164
|
+
bool hasModifyingCTE pg_node_attr(query_jumble_ignore);
|
165
|
+
/* FOR [KEY] UPDATE/SHARE was specified */
|
166
|
+
bool hasForUpdate pg_node_attr(query_jumble_ignore);
|
167
|
+
/* rewriter has applied some RLS policy */
|
168
|
+
bool hasRowSecurity pg_node_attr(query_jumble_ignore);
|
169
|
+
/* is a RETURN statement */
|
170
|
+
bool isReturn pg_node_attr(query_jumble_ignore);
|
134
171
|
|
135
172
|
List *cteList; /* WITH list (of CommonTableExpr's) */
|
136
173
|
|
137
174
|
List *rtable; /* list of range table entries */
|
138
|
-
|
175
|
+
|
176
|
+
/*
|
177
|
+
* list of RTEPermissionInfo nodes for the rtable entries having
|
178
|
+
* perminfoindex > 0
|
179
|
+
*/
|
180
|
+
List *rteperminfos pg_node_attr(query_jumble_ignore);
|
181
|
+
FromExpr *jointree; /* table join tree (FROM and WHERE clauses);
|
182
|
+
* also USING clause for MERGE */
|
183
|
+
|
184
|
+
List *mergeActionList; /* list of actions for MERGE (only) */
|
185
|
+
/* whether to use outer join */
|
186
|
+
bool mergeUseOuterJoin pg_node_attr(query_jumble_ignore);
|
139
187
|
|
140
188
|
List *targetList; /* target list (of TargetEntry) */
|
141
189
|
|
142
|
-
|
190
|
+
/* OVERRIDING clause */
|
191
|
+
OverridingKind override pg_node_attr(query_jumble_ignore);
|
143
192
|
|
144
193
|
OnConflictExpr *onConflict; /* ON CONFLICT DO [NOTHING | UPDATE] */
|
145
194
|
|
146
195
|
List *returningList; /* return-values list (of TargetEntry) */
|
147
196
|
|
148
197
|
List *groupClause; /* a list of SortGroupClause's */
|
198
|
+
bool groupDistinct; /* is the group by clause distinct? */
|
149
199
|
|
150
200
|
List *groupingSets; /* a list of GroupingSet's if present */
|
151
201
|
|
@@ -166,11 +216,14 @@ typedef struct Query
|
|
166
216
|
Node *setOperations; /* set-operation tree if this is top level of
|
167
217
|
* a UNION/INTERSECT/EXCEPT query */
|
168
218
|
|
169
|
-
|
170
|
-
|
219
|
+
/*
|
220
|
+
* A list of pg_constraint OIDs that the query depends on to be
|
221
|
+
* semantically valid
|
222
|
+
*/
|
223
|
+
List *constraintDeps pg_node_attr(query_jumble_ignore);
|
171
224
|
|
172
|
-
|
173
|
-
|
225
|
+
/* a list of WithCheckOption's (added during rewrite) */
|
226
|
+
List *withCheckOptions pg_node_attr(query_jumble_ignore);
|
174
227
|
|
175
228
|
/*
|
176
229
|
* The following two fields identify the portion of the source text string
|
@@ -178,8 +231,10 @@ typedef struct Query
|
|
178
231
|
* Queries, not in sub-queries. When not set, they might both be zero, or
|
179
232
|
* both be -1 meaning "unknown".
|
180
233
|
*/
|
181
|
-
|
182
|
-
int
|
234
|
+
/* start location, or -1 if unknown */
|
235
|
+
int stmt_location;
|
236
|
+
/* length in bytes; 0 means "rest of string" */
|
237
|
+
int stmt_len pg_node_attr(query_jumble_ignore);
|
183
238
|
} Query;
|
184
239
|
|
185
240
|
|
@@ -207,7 +262,7 @@ typedef struct Query
|
|
207
262
|
typedef struct TypeName
|
208
263
|
{
|
209
264
|
NodeTag type;
|
210
|
-
List *names; /* qualified name (list of
|
265
|
+
List *names; /* qualified name (list of String nodes) */
|
211
266
|
Oid typeOid; /* type identified by OID */
|
212
267
|
bool setof; /* is a set? */
|
213
268
|
bool pct_type; /* %TYPE specified? */
|
@@ -220,7 +275,7 @@ typedef struct TypeName
|
|
220
275
|
/*
|
221
276
|
* ColumnRef - specifies a reference to a column, or possibly a whole tuple
|
222
277
|
*
|
223
|
-
* The "fields" list must be nonempty. It can contain
|
278
|
+
* The "fields" list must be nonempty. It can contain String nodes
|
224
279
|
* (representing names) and A_Star nodes (representing occurrence of a '*').
|
225
280
|
* Currently, A_Star must appear only as the last list element --- the grammar
|
226
281
|
* is responsible for enforcing this!
|
@@ -233,7 +288,7 @@ typedef struct TypeName
|
|
233
288
|
typedef struct ColumnRef
|
234
289
|
{
|
235
290
|
NodeTag type;
|
236
|
-
List *fields; /* field names (
|
291
|
+
List *fields; /* field names (String nodes) or A_Star */
|
237
292
|
int location; /* token location, or -1 if unknown */
|
238
293
|
} ColumnRef;
|
239
294
|
|
@@ -258,7 +313,6 @@ typedef enum A_Expr_Kind
|
|
258
313
|
AEXPR_DISTINCT, /* IS DISTINCT FROM - name must be "=" */
|
259
314
|
AEXPR_NOT_DISTINCT, /* IS NOT DISTINCT FROM - name must be "=" */
|
260
315
|
AEXPR_NULLIF, /* NULLIF - name must be "=" */
|
261
|
-
AEXPR_OF, /* IS [NOT] OF - name must be "=" or "<>" */
|
262
316
|
AEXPR_IN, /* [NOT] IN - name must be "=" or "<>" */
|
263
317
|
AEXPR_LIKE, /* [NOT] LIKE - name must be "~~" or "!~~" */
|
264
318
|
AEXPR_ILIKE, /* [NOT] ILIKE - name must be "~~*" or "!~~*" */
|
@@ -266,12 +320,13 @@ typedef enum A_Expr_Kind
|
|
266
320
|
AEXPR_BETWEEN, /* name must be "BETWEEN" */
|
267
321
|
AEXPR_NOT_BETWEEN, /* name must be "NOT BETWEEN" */
|
268
322
|
AEXPR_BETWEEN_SYM, /* name must be "BETWEEN SYMMETRIC" */
|
269
|
-
AEXPR_NOT_BETWEEN_SYM
|
270
|
-
AEXPR_PAREN /* nameless dummy node for parentheses */
|
323
|
+
AEXPR_NOT_BETWEEN_SYM /* name must be "NOT BETWEEN SYMMETRIC" */
|
271
324
|
} A_Expr_Kind;
|
272
325
|
|
273
326
|
typedef struct A_Expr
|
274
327
|
{
|
328
|
+
pg_node_attr(custom_read_write)
|
329
|
+
|
275
330
|
NodeTag type;
|
276
331
|
A_Expr_Kind kind; /* see above */
|
277
332
|
List *name; /* possibly-qualified name of operator */
|
@@ -282,11 +337,27 @@ typedef struct A_Expr
|
|
282
337
|
|
283
338
|
/*
|
284
339
|
* A_Const - a literal constant
|
340
|
+
*
|
341
|
+
* Value nodes are inline for performance. You can treat 'val' as a node,
|
342
|
+
* as in IsA(&val, Integer). 'val' is not valid if isnull is true.
|
285
343
|
*/
|
344
|
+
union ValUnion
|
345
|
+
{
|
346
|
+
Node node;
|
347
|
+
Integer ival;
|
348
|
+
Float fval;
|
349
|
+
Boolean boolval;
|
350
|
+
String sval;
|
351
|
+
BitString bsval;
|
352
|
+
};
|
353
|
+
|
286
354
|
typedef struct A_Const
|
287
355
|
{
|
356
|
+
pg_node_attr(custom_copy_equal, custom_read_write, custom_query_jumble)
|
357
|
+
|
288
358
|
NodeTag type;
|
289
|
-
|
359
|
+
union ValUnion val;
|
360
|
+
bool isnull; /* SQL NULL constant */
|
290
361
|
int location; /* token location, or -1 if unknown */
|
291
362
|
} A_Const;
|
292
363
|
|
@@ -318,6 +389,7 @@ typedef struct CollateClause
|
|
318
389
|
typedef enum RoleSpecType
|
319
390
|
{
|
320
391
|
ROLESPEC_CSTRING, /* role name is stored as a C string */
|
392
|
+
ROLESPEC_CURRENT_ROLE, /* role spec is CURRENT_ROLE */
|
321
393
|
ROLESPEC_CURRENT_USER, /* role spec is CURRENT_USER */
|
322
394
|
ROLESPEC_SESSION_USER, /* role spec is SESSION_USER */
|
323
395
|
ROLESPEC_PUBLIC /* role name is "public" */
|
@@ -352,11 +424,12 @@ typedef struct FuncCall
|
|
352
424
|
List *args; /* the arguments (list of exprs) */
|
353
425
|
List *agg_order; /* ORDER BY (list of SortBy) */
|
354
426
|
Node *agg_filter; /* FILTER clause, if any */
|
427
|
+
struct WindowDef *over; /* OVER clause, if any */
|
355
428
|
bool agg_within_group; /* ORDER BY appeared in WITHIN GROUP */
|
356
429
|
bool agg_star; /* argument was really '*' */
|
357
430
|
bool agg_distinct; /* arguments were labeled DISTINCT */
|
358
431
|
bool func_variadic; /* last argument was labeled VARIADIC */
|
359
|
-
|
432
|
+
CoercionForm funcformat; /* how to display this node */
|
360
433
|
int location; /* token location, or -1 if unknown */
|
361
434
|
} FuncCall;
|
362
435
|
|
@@ -389,7 +462,7 @@ typedef struct A_Indices
|
|
389
462
|
* A_Indirection - select a field and/or array element from an expression
|
390
463
|
*
|
391
464
|
* The indirection list can contain A_Indices nodes (representing
|
392
|
-
* subscripting),
|
465
|
+
* subscripting), String nodes (representing field selection --- the
|
393
466
|
* string value is the name of the field to select), and A_Star nodes
|
394
467
|
* (representing selection of all fields of a composite type).
|
395
468
|
* For example, a complex selection operation like
|
@@ -646,11 +719,13 @@ typedef struct ColumnDef
|
|
646
719
|
NodeTag type;
|
647
720
|
char *colname; /* name of column */
|
648
721
|
TypeName *typeName; /* type of column */
|
722
|
+
char *compression; /* compression method for column */
|
649
723
|
int inhcount; /* number of times column is inherited */
|
650
724
|
bool is_local; /* column has local (non-inherited) def'n */
|
651
725
|
bool is_not_null; /* NOT NULL constraint specified? */
|
652
726
|
bool is_from_type; /* column definition came from table type */
|
653
727
|
char storage; /* attstorage setting, or 0 for default */
|
728
|
+
char *storage_name; /* attstorage setting name or NULL for default */
|
654
729
|
Node *raw_default; /* default value (untransformed parse tree) */
|
655
730
|
Node *cooked_default; /* default value (transformed expr tree) */
|
656
731
|
char identity; /* attidentity setting */
|
@@ -678,13 +753,14 @@ typedef struct TableLikeClause
|
|
678
753
|
typedef enum TableLikeOption
|
679
754
|
{
|
680
755
|
CREATE_TABLE_LIKE_COMMENTS = 1 << 0,
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
756
|
+
CREATE_TABLE_LIKE_COMPRESSION = 1 << 1,
|
757
|
+
CREATE_TABLE_LIKE_CONSTRAINTS = 1 << 2,
|
758
|
+
CREATE_TABLE_LIKE_DEFAULTS = 1 << 3,
|
759
|
+
CREATE_TABLE_LIKE_GENERATED = 1 << 4,
|
760
|
+
CREATE_TABLE_LIKE_IDENTITY = 1 << 5,
|
761
|
+
CREATE_TABLE_LIKE_INDEXES = 1 << 6,
|
762
|
+
CREATE_TABLE_LIKE_STATISTICS = 1 << 7,
|
763
|
+
CREATE_TABLE_LIKE_STORAGE = 1 << 8,
|
688
764
|
CREATE_TABLE_LIKE_ALL = PG_INT32_MAX
|
689
765
|
} TableLikeOption;
|
690
766
|
|
@@ -731,7 +807,8 @@ typedef struct DefElem
|
|
731
807
|
NodeTag type;
|
732
808
|
char *defnamespace; /* NULL if unqualified name */
|
733
809
|
char *defname;
|
734
|
-
Node *arg; /*
|
810
|
+
Node *arg; /* typically Integer, Float, String, or
|
811
|
+
* TypeName */
|
735
812
|
DefElemAction defaction; /* unspecified action, or SET/ADD/DROP */
|
736
813
|
int location; /* token location, or -1 if unknown */
|
737
814
|
} DefElem;
|
@@ -762,6 +839,7 @@ typedef struct XmlSerialize
|
|
762
839
|
XmlOptionType xmloption; /* DOCUMENT or CONTENT */
|
763
840
|
Node *expr;
|
764
841
|
TypeName *typeName;
|
842
|
+
bool indent; /* [NO] INDENT */
|
765
843
|
int location; /* token location, or -1 if unknown */
|
766
844
|
} XmlSerialize;
|
767
845
|
|
@@ -783,6 +861,13 @@ typedef struct PartitionElem
|
|
783
861
|
int location; /* token location, or -1 if unknown */
|
784
862
|
} PartitionElem;
|
785
863
|
|
864
|
+
typedef enum PartitionStrategy
|
865
|
+
{
|
866
|
+
PARTITION_STRATEGY_LIST = 'l',
|
867
|
+
PARTITION_STRATEGY_RANGE = 'r',
|
868
|
+
PARTITION_STRATEGY_HASH = 'h'
|
869
|
+
} PartitionStrategy;
|
870
|
+
|
786
871
|
/*
|
787
872
|
* PartitionSpec - parse-time representation of a partition key specification
|
788
873
|
*
|
@@ -791,17 +876,11 @@ typedef struct PartitionElem
|
|
791
876
|
typedef struct PartitionSpec
|
792
877
|
{
|
793
878
|
NodeTag type;
|
794
|
-
|
795
|
-
* 'range') */
|
879
|
+
PartitionStrategy strategy;
|
796
880
|
List *partParams; /* List of PartitionElems */
|
797
881
|
int location; /* token location, or -1 if unknown */
|
798
882
|
} PartitionSpec;
|
799
883
|
|
800
|
-
/* Internal codes for partitioning strategies */
|
801
|
-
#define PARTITION_STRATEGY_HASH 'h'
|
802
|
-
#define PARTITION_STRATEGY_LIST 'l'
|
803
|
-
#define PARTITION_STRATEGY_RANGE 'r'
|
804
|
-
|
805
884
|
/*
|
806
885
|
* PartitionBoundSpec - a partition bound specification
|
807
886
|
*
|
@@ -860,6 +939,7 @@ typedef struct PartitionCmd
|
|
860
939
|
NodeTag type;
|
861
940
|
RangeVar *name; /* name of partition to attach/detach */
|
862
941
|
PartitionBoundSpec *bound; /* FOR VALUES, if attaching */
|
942
|
+
bool concurrent;
|
863
943
|
} PartitionCmd;
|
864
944
|
|
865
945
|
/****************************************************************************
|
@@ -915,41 +995,10 @@ typedef struct PartitionCmd
|
|
915
995
|
* inFromCl marks those range variables that are listed in the FROM clause.
|
916
996
|
* It's false for RTEs that are added to a query behind the scenes, such
|
917
997
|
* as the NEW and OLD variables for a rule, or the subqueries of a UNION.
|
918
|
-
* This flag is not used
|
919
|
-
* a separate "namespace" data structure to
|
920
|
-
* needed by ruleutils.c to determine
|
921
|
-
* decompiled queries.
|
922
|
-
*
|
923
|
-
* requiredPerms and checkAsUser specify run-time access permissions
|
924
|
-
* checks to be performed at query startup. The user must have *all*
|
925
|
-
* of the permissions that are OR'd together in requiredPerms (zero
|
926
|
-
* indicates no permissions checking). If checkAsUser is not zero,
|
927
|
-
* then do the permissions checks using the access rights of that user,
|
928
|
-
* not the current effective user ID. (This allows rules to act as
|
929
|
-
* setuid gateways.) Permissions checks only apply to RELATION RTEs.
|
930
|
-
*
|
931
|
-
* For SELECT/INSERT/UPDATE permissions, if the user doesn't have
|
932
|
-
* table-wide permissions then it is sufficient to have the permissions
|
933
|
-
* on all columns identified in selectedCols (for SELECT) and/or
|
934
|
-
* insertedCols and/or updatedCols (INSERT with ON CONFLICT DO UPDATE may
|
935
|
-
* have all 3). selectedCols, insertedCols and updatedCols are bitmapsets,
|
936
|
-
* which cannot have negative integer members, so we subtract
|
937
|
-
* FirstLowInvalidHeapAttributeNumber from column numbers before storing
|
938
|
-
* them in these fields. A whole-row Var reference is represented by
|
939
|
-
* setting the bit for InvalidAttrNumber.
|
940
|
-
*
|
941
|
-
* updatedCols is also used in some other places, for example, to determine
|
942
|
-
* which triggers to fire and in FDWs to know which changed columns they
|
943
|
-
* need to ship off.
|
944
|
-
*
|
945
|
-
* Generated columns that are caused to be updated by an update to a base
|
946
|
-
* column are listed in extraUpdatedCols. This is not considered for
|
947
|
-
* permission checking, but it is useful in those places that want to know
|
948
|
-
* the full set of columns being updated as opposed to only the ones the
|
949
|
-
* user explicitly mentioned in the query. (There is currently no need for
|
950
|
-
* an extraInsertedCols, but it could exist.) Note that extraUpdatedCols
|
951
|
-
* is populated during query rewrite, NOT in the parser, since generated
|
952
|
-
* columns could be added after a rule has been parsed and stored.
|
998
|
+
* This flag is not used during parsing (except in transformLockingClause,
|
999
|
+
* q.v.); the parser now uses a separate "namespace" data structure to
|
1000
|
+
* control visibility. But it is needed by ruleutils.c to determine
|
1001
|
+
* whether RTEs should be shown in decompiled queries.
|
953
1002
|
*
|
954
1003
|
* securityQuals is a list of security barrier quals (boolean expressions),
|
955
1004
|
* to be tested in the listed order before returning a row from the
|
@@ -976,6 +1025,8 @@ typedef enum RTEKind
|
|
976
1025
|
|
977
1026
|
typedef struct RangeTblEntry
|
978
1027
|
{
|
1028
|
+
pg_node_attr(custom_read_write, custom_query_jumble)
|
1029
|
+
|
979
1030
|
NodeTag type;
|
980
1031
|
|
981
1032
|
RTEKind rtekind; /* see above */
|
@@ -989,26 +1040,39 @@ typedef struct RangeTblEntry
|
|
989
1040
|
/*
|
990
1041
|
* Fields valid for a plain relation RTE (else zero):
|
991
1042
|
*
|
992
|
-
* As a special case, RTE_NAMEDTUPLESTORE can also set relid to indicate
|
993
|
-
* that the tuple format of the tuplestore is the same as the referenced
|
994
|
-
* relation. This allows plans referencing AFTER trigger transition
|
995
|
-
* tables to be invalidated if the underlying table is altered.
|
996
|
-
*
|
997
1043
|
* rellockmode is really LOCKMODE, but it's declared int to avoid having
|
998
1044
|
* to include lock-related headers here. It must be RowExclusiveLock if
|
999
|
-
* the RTE is an INSERT/UPDATE/DELETE target, else RowShareLock if
|
1000
|
-
* is a SELECT FOR UPDATE/FOR SHARE target, else AccessShareLock.
|
1045
|
+
* the RTE is an INSERT/UPDATE/DELETE/MERGE target, else RowShareLock if
|
1046
|
+
* the RTE is a SELECT FOR UPDATE/FOR SHARE target, else AccessShareLock.
|
1001
1047
|
*
|
1002
1048
|
* Note: in some cases, rule expansion may result in RTEs that are marked
|
1003
1049
|
* with RowExclusiveLock even though they are not the target of the
|
1004
1050
|
* current query; this happens if a DO ALSO rule simply scans the original
|
1005
1051
|
* target table. We leave such RTEs with their original lockmode so as to
|
1006
1052
|
* avoid getting an additional, lesser lock.
|
1053
|
+
*
|
1054
|
+
* perminfoindex is 1-based index of the RTEPermissionInfo belonging to
|
1055
|
+
* this RTE in the containing struct's list of same; 0 if permissions need
|
1056
|
+
* not be checked for this RTE.
|
1057
|
+
*
|
1058
|
+
* As a special case, relid, relkind, rellockmode, and perminfoindex can
|
1059
|
+
* also be set (nonzero) in an RTE_SUBQUERY RTE. This occurs when we
|
1060
|
+
* convert an RTE_RELATION RTE naming a view into an RTE_SUBQUERY
|
1061
|
+
* containing the view's query. We still need to perform run-time locking
|
1062
|
+
* and permission checks on the view, even though it's not directly used
|
1063
|
+
* in the query anymore, and the most expedient way to do that is to
|
1064
|
+
* retain these fields from the old state of the RTE.
|
1065
|
+
*
|
1066
|
+
* As a special case, RTE_NAMEDTUPLESTORE can also set relid to indicate
|
1067
|
+
* that the tuple format of the tuplestore is the same as the referenced
|
1068
|
+
* relation. This allows plans referencing AFTER trigger transition
|
1069
|
+
* tables to be invalidated if the underlying table is altered.
|
1007
1070
|
*/
|
1008
1071
|
Oid relid; /* OID of the relation */
|
1009
1072
|
char relkind; /* relation kind (see pg_class.relkind) */
|
1010
1073
|
int rellockmode; /* lock level that query requires on the rel */
|
1011
1074
|
struct TableSampleClause *tablesample; /* sampling info, or NULL */
|
1075
|
+
Index perminfoindex;
|
1012
1076
|
|
1013
1077
|
/*
|
1014
1078
|
* Fields valid for a subquery RTE (else NULL):
|
@@ -1032,6 +1096,14 @@ typedef struct RangeTblEntry
|
|
1032
1096
|
* alias Vars are generated only for merged columns). We keep these
|
1033
1097
|
* entries only because they're needed in expandRTE() and similar code.
|
1034
1098
|
*
|
1099
|
+
* Vars appearing within joinaliasvars are marked with varnullingrels sets
|
1100
|
+
* that describe the nulling effects of this join and lower ones. This is
|
1101
|
+
* essential for FULL JOIN cases, because the COALESCE expression only
|
1102
|
+
* describes the semantics correctly if its inputs have been nulled by the
|
1103
|
+
* join. For other cases, it allows expandRTE() to generate a valid
|
1104
|
+
* representation of the join's output without consulting additional
|
1105
|
+
* parser state.
|
1106
|
+
*
|
1035
1107
|
* Within a Query loaded from a stored rule, it is possible for non-merged
|
1036
1108
|
* joinaliasvars items to be null pointers, which are placeholders for
|
1037
1109
|
* (necessarily unreferenced) columns dropped since the rule was made.
|
@@ -1057,6 +1129,13 @@ typedef struct RangeTblEntry
|
|
1057
1129
|
List *joinleftcols; /* left-side input column numbers */
|
1058
1130
|
List *joinrightcols; /* right-side input column numbers */
|
1059
1131
|
|
1132
|
+
/*
|
1133
|
+
* join_using_alias is an alias clause attached directly to JOIN/USING. It
|
1134
|
+
* is different from the alias field (below) in that it does not hide the
|
1135
|
+
* range variables of the tables being joined.
|
1136
|
+
*/
|
1137
|
+
Alias *join_using_alias;
|
1138
|
+
|
1060
1139
|
/*
|
1061
1140
|
* Fields valid for a function RTE (else NIL/zero):
|
1062
1141
|
*
|
@@ -1111,7 +1190,7 @@ typedef struct RangeTblEntry
|
|
1111
1190
|
* Fields valid for ENR RTEs (else NULL/zero):
|
1112
1191
|
*/
|
1113
1192
|
char *enrname; /* name of ephemeral named relation */
|
1114
|
-
|
1193
|
+
Cardinality enrtuples; /* estimated or actual from caller */
|
1115
1194
|
|
1116
1195
|
/*
|
1117
1196
|
* Fields valid in all RTEs:
|
@@ -1121,14 +1200,54 @@ typedef struct RangeTblEntry
|
|
1121
1200
|
bool lateral; /* subquery, function, or values is LATERAL? */
|
1122
1201
|
bool inh; /* inheritance requested? */
|
1123
1202
|
bool inFromCl; /* present in FROM clause? */
|
1203
|
+
List *securityQuals; /* security barrier quals to apply, if any */
|
1204
|
+
} RangeTblEntry;
|
1205
|
+
|
1206
|
+
/*
|
1207
|
+
* RTEPermissionInfo
|
1208
|
+
* Per-relation information for permission checking. Added to the Query
|
1209
|
+
* node by the parser when adding the corresponding RTE to the query
|
1210
|
+
* range table and subsequently editorialized on by the rewriter if
|
1211
|
+
* needed after rule expansion.
|
1212
|
+
*
|
1213
|
+
* Only the relations directly mentioned in the query are checked for
|
1214
|
+
* access permissions by the core executor, so only their RTEPermissionInfos
|
1215
|
+
* are present in the Query. However, extensions may want to check inheritance
|
1216
|
+
* children too, depending on the value of rte->inh, so it's copied in 'inh'
|
1217
|
+
* for their perusal.
|
1218
|
+
*
|
1219
|
+
* requiredPerms and checkAsUser specify run-time access permissions checks
|
1220
|
+
* to be performed at query startup. The user must have *all* of the
|
1221
|
+
* permissions that are OR'd together in requiredPerms (never 0!). If
|
1222
|
+
* checkAsUser is not zero, then do the permissions checks using the access
|
1223
|
+
* rights of that user, not the current effective user ID. (This allows rules
|
1224
|
+
* to act as setuid gateways.)
|
1225
|
+
*
|
1226
|
+
* For SELECT/INSERT/UPDATE permissions, if the user doesn't have table-wide
|
1227
|
+
* permissions then it is sufficient to have the permissions on all columns
|
1228
|
+
* identified in selectedCols (for SELECT) and/or insertedCols and/or
|
1229
|
+
* updatedCols (INSERT with ON CONFLICT DO UPDATE may have all 3).
|
1230
|
+
* selectedCols, insertedCols and updatedCols are bitmapsets, which cannot have
|
1231
|
+
* negative integer members, so we subtract FirstLowInvalidHeapAttributeNumber
|
1232
|
+
* from column numbers before storing them in these fields. A whole-row Var
|
1233
|
+
* reference is represented by setting the bit for InvalidAttrNumber.
|
1234
|
+
*
|
1235
|
+
* updatedCols is also used in some other places, for example, to determine
|
1236
|
+
* which triggers to fire and in FDWs to know which changed columns they need
|
1237
|
+
* to ship off.
|
1238
|
+
*/
|
1239
|
+
typedef struct RTEPermissionInfo
|
1240
|
+
{
|
1241
|
+
NodeTag type;
|
1242
|
+
|
1243
|
+
Oid relid; /* relation OID */
|
1244
|
+
bool inh; /* separately check inheritance children? */
|
1124
1245
|
AclMode requiredPerms; /* bitmask of required access permissions */
|
1125
1246
|
Oid checkAsUser; /* if valid, check access as this role */
|
1126
1247
|
Bitmapset *selectedCols; /* columns needing SELECT permission */
|
1127
1248
|
Bitmapset *insertedCols; /* columns needing INSERT permission */
|
1128
1249
|
Bitmapset *updatedCols; /* columns needing UPDATE permission */
|
1129
|
-
|
1130
|
-
List *securityQuals; /* security barrier quals to apply, if any */
|
1131
|
-
} RangeTblEntry;
|
1250
|
+
} RTEPermissionInfo;
|
1132
1251
|
|
1133
1252
|
/*
|
1134
1253
|
* RangeTblFunction -
|
@@ -1145,20 +1264,29 @@ typedef struct RangeTblEntry
|
|
1145
1264
|
* time. We do however remember how many columns we thought the type had
|
1146
1265
|
* (including dropped columns!), so that we can successfully ignore any
|
1147
1266
|
* columns added after the query was parsed.
|
1267
|
+
*
|
1268
|
+
* The query jumbling only needs to track the function expression.
|
1148
1269
|
*/
|
1149
1270
|
typedef struct RangeTblFunction
|
1150
1271
|
{
|
1151
1272
|
NodeTag type;
|
1152
1273
|
|
1153
1274
|
Node *funcexpr; /* expression tree for func call */
|
1154
|
-
|
1275
|
+
/* number of columns it contributes to RTE */
|
1276
|
+
int funccolcount pg_node_attr(query_jumble_ignore);
|
1155
1277
|
/* These fields record the contents of a column definition list, if any: */
|
1156
|
-
|
1157
|
-
List *
|
1158
|
-
|
1159
|
-
List *
|
1278
|
+
/* column names (list of String) */
|
1279
|
+
List *funccolnames pg_node_attr(query_jumble_ignore);
|
1280
|
+
/* OID list of column type OIDs */
|
1281
|
+
List *funccoltypes pg_node_attr(query_jumble_ignore);
|
1282
|
+
/* integer list of column typmods */
|
1283
|
+
List *funccoltypmods pg_node_attr(query_jumble_ignore);
|
1284
|
+
/* OID list of column collation OIDs */
|
1285
|
+
List *funccolcollations pg_node_attr(query_jumble_ignore);
|
1286
|
+
|
1160
1287
|
/* This is set during planning for use by the executor: */
|
1161
|
-
|
1288
|
+
/* PARAM_EXEC Param IDs affecting this func */
|
1289
|
+
Bitmapset *funcparams pg_node_attr(query_jumble_ignore);
|
1162
1290
|
} RangeTblFunction;
|
1163
1291
|
|
1164
1292
|
/*
|
@@ -1185,7 +1313,9 @@ typedef enum WCOKind
|
|
1185
1313
|
WCO_VIEW_CHECK, /* WCO on an auto-updatable view */
|
1186
1314
|
WCO_RLS_INSERT_CHECK, /* RLS INSERT WITH CHECK policy */
|
1187
1315
|
WCO_RLS_UPDATE_CHECK, /* RLS UPDATE WITH CHECK policy */
|
1188
|
-
WCO_RLS_CONFLICT_CHECK /* RLS ON CONFLICT DO UPDATE USING policy */
|
1316
|
+
WCO_RLS_CONFLICT_CHECK, /* RLS ON CONFLICT DO UPDATE USING policy */
|
1317
|
+
WCO_RLS_MERGE_UPDATE_CHECK, /* RLS MERGE UPDATE USING policy */
|
1318
|
+
WCO_RLS_MERGE_DELETE_CHECK /* RLS MERGE DELETE USING policy */
|
1189
1319
|
} WCOKind;
|
1190
1320
|
|
1191
1321
|
typedef struct WithCheckOption
|
@@ -1263,7 +1393,8 @@ typedef struct SortGroupClause
|
|
1263
1393
|
Oid eqop; /* the equality operator ('=' op) */
|
1264
1394
|
Oid sortop; /* the ordering operator ('<' op), or 0 */
|
1265
1395
|
bool nulls_first; /* do NULLs come before normal values? */
|
1266
|
-
|
1396
|
+
/* can eqop be implemented by hashing? */
|
1397
|
+
bool hashable pg_node_attr(query_jumble_ignore);
|
1267
1398
|
} SortGroupClause;
|
1268
1399
|
|
1269
1400
|
/*
|
@@ -1316,7 +1447,7 @@ typedef struct SortGroupClause
|
|
1316
1447
|
*
|
1317
1448
|
* SETS( SIMPLE(1,2), CUBE( SIMPLE(3), SIMPLE(4,5) ) )
|
1318
1449
|
*/
|
1319
|
-
typedef enum
|
1450
|
+
typedef enum GroupingSetKind
|
1320
1451
|
{
|
1321
1452
|
GROUPING_SET_EMPTY,
|
1322
1453
|
GROUPING_SET_SIMPLE,
|
@@ -1328,7 +1459,7 @@ typedef enum
|
|
1328
1459
|
typedef struct GroupingSet
|
1329
1460
|
{
|
1330
1461
|
NodeTag type;
|
1331
|
-
GroupingSetKind kind;
|
1462
|
+
GroupingSetKind kind pg_node_attr(query_jumble_ignore);
|
1332
1463
|
List *content;
|
1333
1464
|
int location;
|
1334
1465
|
} GroupingSet;
|
@@ -1349,24 +1480,38 @@ typedef struct GroupingSet
|
|
1349
1480
|
* When refname isn't null, the partitionClause is always copied from there;
|
1350
1481
|
* the orderClause might or might not be copied (see copiedOrder); the framing
|
1351
1482
|
* options are never copied, per spec.
|
1483
|
+
*
|
1484
|
+
* The information relevant for the query jumbling is the partition clause
|
1485
|
+
* type and its bounds.
|
1352
1486
|
*/
|
1353
1487
|
typedef struct WindowClause
|
1354
1488
|
{
|
1355
1489
|
NodeTag type;
|
1356
|
-
|
1357
|
-
char *
|
1490
|
+
/* window name (NULL in an OVER clause) */
|
1491
|
+
char *name pg_node_attr(query_jumble_ignore);
|
1492
|
+
/* referenced window name, if any */
|
1493
|
+
char *refname pg_node_attr(query_jumble_ignore);
|
1358
1494
|
List *partitionClause; /* PARTITION BY list */
|
1359
|
-
|
1495
|
+
/* ORDER BY list */
|
1496
|
+
List *orderClause;
|
1360
1497
|
int frameOptions; /* frame_clause options, see WindowDef */
|
1361
1498
|
Node *startOffset; /* expression for starting bound, if any */
|
1362
1499
|
Node *endOffset; /* expression for ending bound, if any */
|
1363
|
-
|
1364
|
-
|
1365
|
-
|
1366
|
-
|
1367
|
-
|
1500
|
+
/* qual to help short-circuit execution */
|
1501
|
+
List *runCondition pg_node_attr(query_jumble_ignore);
|
1502
|
+
/* in_range function for startOffset */
|
1503
|
+
Oid startInRangeFunc pg_node_attr(query_jumble_ignore);
|
1504
|
+
/* in_range function for endOffset */
|
1505
|
+
Oid endInRangeFunc pg_node_attr(query_jumble_ignore);
|
1506
|
+
/* collation for in_range tests */
|
1507
|
+
Oid inRangeColl pg_node_attr(query_jumble_ignore);
|
1508
|
+
/* use ASC sort order for in_range tests? */
|
1509
|
+
bool inRangeAsc pg_node_attr(query_jumble_ignore);
|
1510
|
+
/* nulls sort first for in_range tests? */
|
1511
|
+
bool inRangeNullsFirst pg_node_attr(query_jumble_ignore);
|
1368
1512
|
Index winref; /* ID referenced by window functions */
|
1369
|
-
|
1513
|
+
/* did we copy orderClause from refname? */
|
1514
|
+
bool copiedOrder pg_node_attr(query_jumble_ignore);
|
1370
1515
|
} WindowClause;
|
1371
1516
|
|
1372
1517
|
/*
|
@@ -1439,9 +1584,8 @@ typedef struct OnConflictClause
|
|
1439
1584
|
/*
|
1440
1585
|
* CommonTableExpr -
|
1441
1586
|
* representation of WITH list element
|
1442
|
-
*
|
1443
|
-
* We don't currently support the SEARCH or CYCLE clause.
|
1444
1587
|
*/
|
1588
|
+
|
1445
1589
|
typedef enum CTEMaterialize
|
1446
1590
|
{
|
1447
1591
|
CTEMaterializeDefault, /* no option specified */
|
@@ -1449,23 +1593,65 @@ typedef enum CTEMaterialize
|
|
1449
1593
|
CTEMaterializeNever /* NOT MATERIALIZED */
|
1450
1594
|
} CTEMaterialize;
|
1451
1595
|
|
1596
|
+
typedef struct CTESearchClause
|
1597
|
+
{
|
1598
|
+
NodeTag type;
|
1599
|
+
List *search_col_list;
|
1600
|
+
bool search_breadth_first;
|
1601
|
+
char *search_seq_column;
|
1602
|
+
int location;
|
1603
|
+
} CTESearchClause;
|
1604
|
+
|
1605
|
+
typedef struct CTECycleClause
|
1606
|
+
{
|
1607
|
+
NodeTag type;
|
1608
|
+
List *cycle_col_list;
|
1609
|
+
char *cycle_mark_column;
|
1610
|
+
Node *cycle_mark_value;
|
1611
|
+
Node *cycle_mark_default;
|
1612
|
+
char *cycle_path_column;
|
1613
|
+
int location;
|
1614
|
+
/* These fields are set during parse analysis: */
|
1615
|
+
Oid cycle_mark_type; /* common type of _value and _default */
|
1616
|
+
int cycle_mark_typmod;
|
1617
|
+
Oid cycle_mark_collation;
|
1618
|
+
Oid cycle_mark_neop; /* <> operator for type */
|
1619
|
+
} CTECycleClause;
|
1620
|
+
|
1452
1621
|
typedef struct CommonTableExpr
|
1453
1622
|
{
|
1454
1623
|
NodeTag type;
|
1455
|
-
|
1456
|
-
|
1624
|
+
|
1625
|
+
/*
|
1626
|
+
* Query name (never qualified). The string name is included in the query
|
1627
|
+
* jumbling because RTE_CTE RTEs need it.
|
1628
|
+
*/
|
1629
|
+
char *ctename;
|
1630
|
+
/* optional list of column names */
|
1631
|
+
List *aliascolnames pg_node_attr(query_jumble_ignore);
|
1457
1632
|
CTEMaterialize ctematerialized; /* is this an optimization fence? */
|
1458
1633
|
/* SelectStmt/InsertStmt/etc before parse analysis, Query afterwards: */
|
1459
1634
|
Node *ctequery; /* the CTE's subquery */
|
1635
|
+
CTESearchClause *search_clause pg_node_attr(query_jumble_ignore);
|
1636
|
+
CTECycleClause *cycle_clause pg_node_attr(query_jumble_ignore);
|
1460
1637
|
int location; /* token location, or -1 if unknown */
|
1461
1638
|
/* These fields are set during parse analysis: */
|
1462
|
-
|
1463
|
-
|
1464
|
-
|
1465
|
-
|
1466
|
-
|
1467
|
-
|
1468
|
-
|
1639
|
+
/* is this CTE actually recursive? */
|
1640
|
+
bool cterecursive pg_node_attr(query_jumble_ignore);
|
1641
|
+
|
1642
|
+
/*
|
1643
|
+
* Number of RTEs referencing this CTE (excluding internal
|
1644
|
+
* self-references), irrelevant for query jumbling.
|
1645
|
+
*/
|
1646
|
+
int cterefcount pg_node_attr(query_jumble_ignore);
|
1647
|
+
/* list of output column names */
|
1648
|
+
List *ctecolnames pg_node_attr(query_jumble_ignore);
|
1649
|
+
/* OID list of output column type OIDs */
|
1650
|
+
List *ctecoltypes pg_node_attr(query_jumble_ignore);
|
1651
|
+
/* integer list of output column typmods */
|
1652
|
+
List *ctecoltypmods pg_node_attr(query_jumble_ignore);
|
1653
|
+
/* OID list of column collation OIDs */
|
1654
|
+
List *ctecolcollations pg_node_attr(query_jumble_ignore);
|
1469
1655
|
} CommonTableExpr;
|
1470
1656
|
|
1471
1657
|
/* Convenience macro to get the output tlist of a CTE's query */
|
@@ -1475,6 +1661,41 @@ typedef struct CommonTableExpr
|
|
1475
1661
|
((Query *) (cte)->ctequery)->targetList : \
|
1476
1662
|
((Query *) (cte)->ctequery)->returningList)
|
1477
1663
|
|
1664
|
+
/*
|
1665
|
+
* MergeWhenClause -
|
1666
|
+
* raw parser representation of a WHEN clause in a MERGE statement
|
1667
|
+
*
|
1668
|
+
* This is transformed into MergeAction by parse analysis
|
1669
|
+
*/
|
1670
|
+
typedef struct MergeWhenClause
|
1671
|
+
{
|
1672
|
+
NodeTag type;
|
1673
|
+
bool matched; /* true=MATCHED, false=NOT MATCHED */
|
1674
|
+
CmdType commandType; /* INSERT/UPDATE/DELETE/DO NOTHING */
|
1675
|
+
OverridingKind override; /* OVERRIDING clause */
|
1676
|
+
Node *condition; /* WHEN conditions (raw parser) */
|
1677
|
+
List *targetList; /* INSERT/UPDATE targetlist */
|
1678
|
+
/* the following members are only used in INSERT actions */
|
1679
|
+
List *values; /* VALUES to INSERT, or NULL */
|
1680
|
+
} MergeWhenClause;
|
1681
|
+
|
1682
|
+
/*
|
1683
|
+
* MergeAction -
|
1684
|
+
* Transformed representation of a WHEN clause in a MERGE statement
|
1685
|
+
*/
|
1686
|
+
typedef struct MergeAction
|
1687
|
+
{
|
1688
|
+
NodeTag type;
|
1689
|
+
bool matched; /* true=MATCHED, false=NOT MATCHED */
|
1690
|
+
CmdType commandType; /* INSERT/UPDATE/DELETE/DO NOTHING */
|
1691
|
+
/* OVERRIDING clause */
|
1692
|
+
OverridingKind override pg_node_attr(query_jumble_ignore);
|
1693
|
+
Node *qual; /* transformed WHEN conditions */
|
1694
|
+
List *targetList; /* the target list (of TargetEntry) */
|
1695
|
+
/* target attribute numbers of an UPDATE */
|
1696
|
+
List *updateColnos pg_node_attr(query_jumble_ignore);
|
1697
|
+
} MergeAction;
|
1698
|
+
|
1478
1699
|
/*
|
1479
1700
|
* TriggerTransition -
|
1480
1701
|
* representation of transition row or table naming clause
|
@@ -1491,6 +1712,113 @@ typedef struct TriggerTransition
|
|
1491
1712
|
bool isTable;
|
1492
1713
|
} TriggerTransition;
|
1493
1714
|
|
1715
|
+
/* Nodes for SQL/JSON support */
|
1716
|
+
|
1717
|
+
/*
|
1718
|
+
* JsonOutput -
|
1719
|
+
* representation of JSON output clause (RETURNING type [FORMAT format])
|
1720
|
+
*/
|
1721
|
+
typedef struct JsonOutput
|
1722
|
+
{
|
1723
|
+
NodeTag type;
|
1724
|
+
TypeName *typeName; /* RETURNING type name, if specified */
|
1725
|
+
JsonReturning *returning; /* RETURNING FORMAT clause and type Oids */
|
1726
|
+
} JsonOutput;
|
1727
|
+
|
1728
|
+
/*
|
1729
|
+
* JsonKeyValue -
|
1730
|
+
* untransformed representation of JSON object key-value pair for
|
1731
|
+
* JSON_OBJECT() and JSON_OBJECTAGG()
|
1732
|
+
*/
|
1733
|
+
typedef struct JsonKeyValue
|
1734
|
+
{
|
1735
|
+
NodeTag type;
|
1736
|
+
Expr *key; /* key expression */
|
1737
|
+
JsonValueExpr *value; /* JSON value expression */
|
1738
|
+
} JsonKeyValue;
|
1739
|
+
|
1740
|
+
/*
|
1741
|
+
* JsonObjectConstructor -
|
1742
|
+
* untransformed representation of JSON_OBJECT() constructor
|
1743
|
+
*/
|
1744
|
+
typedef struct JsonObjectConstructor
|
1745
|
+
{
|
1746
|
+
NodeTag type;
|
1747
|
+
List *exprs; /* list of JsonKeyValue pairs */
|
1748
|
+
JsonOutput *output; /* RETURNING clause, if specified */
|
1749
|
+
bool absent_on_null; /* skip NULL values? */
|
1750
|
+
bool unique; /* check key uniqueness? */
|
1751
|
+
int location; /* token location, or -1 if unknown */
|
1752
|
+
} JsonObjectConstructor;
|
1753
|
+
|
1754
|
+
/*
|
1755
|
+
* JsonArrayConstructor -
|
1756
|
+
* untransformed representation of JSON_ARRAY(element,...) constructor
|
1757
|
+
*/
|
1758
|
+
typedef struct JsonArrayConstructor
|
1759
|
+
{
|
1760
|
+
NodeTag type;
|
1761
|
+
List *exprs; /* list of JsonValueExpr elements */
|
1762
|
+
JsonOutput *output; /* RETURNING clause, if specified */
|
1763
|
+
bool absent_on_null; /* skip NULL elements? */
|
1764
|
+
int location; /* token location, or -1 if unknown */
|
1765
|
+
} JsonArrayConstructor;
|
1766
|
+
|
1767
|
+
/*
|
1768
|
+
* JsonArrayQueryConstructor -
|
1769
|
+
* untransformed representation of JSON_ARRAY(subquery) constructor
|
1770
|
+
*/
|
1771
|
+
typedef struct JsonArrayQueryConstructor
|
1772
|
+
{
|
1773
|
+
NodeTag type;
|
1774
|
+
Node *query; /* subquery */
|
1775
|
+
JsonOutput *output; /* RETURNING clause, if specified */
|
1776
|
+
JsonFormat *format; /* FORMAT clause for subquery, if specified */
|
1777
|
+
bool absent_on_null; /* skip NULL elements? */
|
1778
|
+
int location; /* token location, or -1 if unknown */
|
1779
|
+
} JsonArrayQueryConstructor;
|
1780
|
+
|
1781
|
+
/*
|
1782
|
+
* JsonAggConstructor -
|
1783
|
+
* common fields of untransformed representation of
|
1784
|
+
* JSON_ARRAYAGG() and JSON_OBJECTAGG()
|
1785
|
+
*/
|
1786
|
+
typedef struct JsonAggConstructor
|
1787
|
+
{
|
1788
|
+
NodeTag type;
|
1789
|
+
JsonOutput *output; /* RETURNING clause, if any */
|
1790
|
+
Node *agg_filter; /* FILTER clause, if any */
|
1791
|
+
List *agg_order; /* ORDER BY clause, if any */
|
1792
|
+
struct WindowDef *over; /* OVER clause, if any */
|
1793
|
+
int location; /* token location, or -1 if unknown */
|
1794
|
+
} JsonAggConstructor;
|
1795
|
+
|
1796
|
+
/*
|
1797
|
+
* JsonObjectAgg -
|
1798
|
+
* untransformed representation of JSON_OBJECTAGG()
|
1799
|
+
*/
|
1800
|
+
typedef struct JsonObjectAgg
|
1801
|
+
{
|
1802
|
+
NodeTag type;
|
1803
|
+
JsonAggConstructor *constructor; /* common fields */
|
1804
|
+
JsonKeyValue *arg; /* object key-value pair */
|
1805
|
+
bool absent_on_null; /* skip NULL values? */
|
1806
|
+
bool unique; /* check key uniqueness? */
|
1807
|
+
} JsonObjectAgg;
|
1808
|
+
|
1809
|
+
/*
|
1810
|
+
* JsonArrayAgg -
|
1811
|
+
* untransformed representation of JSON_ARRAYAGG()
|
1812
|
+
*/
|
1813
|
+
typedef struct JsonArrayAgg
|
1814
|
+
{
|
1815
|
+
NodeTag type;
|
1816
|
+
JsonAggConstructor *constructor; /* common fields */
|
1817
|
+
JsonValueExpr *arg; /* array element expression */
|
1818
|
+
bool absent_on_null; /* skip NULL elements? */
|
1819
|
+
} JsonArrayAgg;
|
1820
|
+
|
1821
|
+
|
1494
1822
|
/*****************************************************************************
|
1495
1823
|
* Raw Grammar Output Statements
|
1496
1824
|
*****************************************************************************/
|
@@ -1506,9 +1834,14 @@ typedef struct TriggerTransition
|
|
1506
1834
|
*
|
1507
1835
|
* stmt_location/stmt_len identify the portion of the source text string
|
1508
1836
|
* containing this raw statement (useful for multi-statement strings).
|
1837
|
+
*
|
1838
|
+
* This is irrelevant for query jumbling, as this is not used in parsed
|
1839
|
+
* queries.
|
1509
1840
|
*/
|
1510
1841
|
typedef struct RawStmt
|
1511
1842
|
{
|
1843
|
+
pg_node_attr(no_query_jumble)
|
1844
|
+
|
1512
1845
|
NodeTag type;
|
1513
1846
|
Node *stmt; /* raw parse tree */
|
1514
1847
|
int stmt_location; /* start location, or -1 if unknown */
|
@@ -1568,6 +1901,20 @@ typedef struct UpdateStmt
|
|
1568
1901
|
WithClause *withClause; /* WITH clause */
|
1569
1902
|
} UpdateStmt;
|
1570
1903
|
|
1904
|
+
/* ----------------------
|
1905
|
+
* Merge Statement
|
1906
|
+
* ----------------------
|
1907
|
+
*/
|
1908
|
+
typedef struct MergeStmt
|
1909
|
+
{
|
1910
|
+
NodeTag type;
|
1911
|
+
RangeVar *relation; /* target relation to merge into */
|
1912
|
+
Node *sourceRelation; /* source relation */
|
1913
|
+
Node *joinCondition; /* join condition between source and target */
|
1914
|
+
List *mergeWhenClauses; /* list of MergeWhenClause(es) */
|
1915
|
+
WithClause *withClause; /* WITH clause */
|
1916
|
+
} MergeStmt;
|
1917
|
+
|
1571
1918
|
/* ----------------------
|
1572
1919
|
* Select Statement
|
1573
1920
|
*
|
@@ -1603,6 +1950,7 @@ typedef struct SelectStmt
|
|
1603
1950
|
List *fromClause; /* the FROM clause */
|
1604
1951
|
Node *whereClause; /* WHERE qualification */
|
1605
1952
|
List *groupClause; /* GROUP BY clauses */
|
1953
|
+
bool groupDistinct; /* Is this GROUP BY DISTINCT? */
|
1606
1954
|
Node *havingClause; /* HAVING conditional-expression */
|
1607
1955
|
List *windowClause; /* WINDOW window_name AS (...), ... */
|
1608
1956
|
|
@@ -1666,15 +2014,48 @@ typedef struct SetOperationStmt
|
|
1666
2014
|
Node *rarg; /* right child */
|
1667
2015
|
/* Eventually add fields for CORRESPONDING spec here */
|
1668
2016
|
|
1669
|
-
/* Fields derived during parse analysis: */
|
1670
|
-
|
1671
|
-
List *
|
1672
|
-
|
1673
|
-
List *
|
2017
|
+
/* Fields derived during parse analysis (irrelevant for query jumbling): */
|
2018
|
+
/* OID list of output column type OIDs */
|
2019
|
+
List *colTypes pg_node_attr(query_jumble_ignore);
|
2020
|
+
/* integer list of output column typmods */
|
2021
|
+
List *colTypmods pg_node_attr(query_jumble_ignore);
|
2022
|
+
/* OID list of output column collation OIDs */
|
2023
|
+
List *colCollations pg_node_attr(query_jumble_ignore);
|
2024
|
+
/* a list of SortGroupClause's */
|
2025
|
+
List *groupClauses pg_node_attr(query_jumble_ignore);
|
1674
2026
|
/* groupClauses is NIL if UNION ALL, but must be set otherwise */
|
1675
2027
|
} SetOperationStmt;
|
1676
2028
|
|
1677
2029
|
|
2030
|
+
/*
|
2031
|
+
* RETURN statement (inside SQL function body)
|
2032
|
+
*/
|
2033
|
+
typedef struct ReturnStmt
|
2034
|
+
{
|
2035
|
+
NodeTag type;
|
2036
|
+
Node *returnval;
|
2037
|
+
} ReturnStmt;
|
2038
|
+
|
2039
|
+
|
2040
|
+
/* ----------------------
|
2041
|
+
* PL/pgSQL Assignment Statement
|
2042
|
+
*
|
2043
|
+
* Like SelectStmt, this is transformed into a SELECT Query.
|
2044
|
+
* However, the targetlist of the result looks more like an UPDATE.
|
2045
|
+
* ----------------------
|
2046
|
+
*/
|
2047
|
+
typedef struct PLAssignStmt
|
2048
|
+
{
|
2049
|
+
NodeTag type;
|
2050
|
+
|
2051
|
+
char *name; /* initial column name */
|
2052
|
+
List *indirection; /* subscripts and field names, if any */
|
2053
|
+
int nnames; /* number of names to use in ColumnRef */
|
2054
|
+
SelectStmt *val; /* the PL/pgSQL expression to assign */
|
2055
|
+
int location; /* name's token location, or -1 if unknown */
|
2056
|
+
} PLAssignStmt;
|
2057
|
+
|
2058
|
+
|
1678
2059
|
/*****************************************************************************
|
1679
2060
|
* Other Statements (no optimizations required)
|
1680
2061
|
*
|
@@ -1724,9 +2105,11 @@ typedef enum ObjectType
|
|
1724
2105
|
OBJECT_OPCLASS,
|
1725
2106
|
OBJECT_OPERATOR,
|
1726
2107
|
OBJECT_OPFAMILY,
|
2108
|
+
OBJECT_PARAMETER_ACL,
|
1727
2109
|
OBJECT_POLICY,
|
1728
2110
|
OBJECT_PROCEDURE,
|
1729
2111
|
OBJECT_PUBLICATION,
|
2112
|
+
OBJECT_PUBLICATION_NAMESPACE,
|
1730
2113
|
OBJECT_PUBLICATION_REL,
|
1731
2114
|
OBJECT_ROLE,
|
1732
2115
|
OBJECT_ROUTINE,
|
@@ -1781,14 +2164,13 @@ typedef struct AlterTableStmt
|
|
1781
2164
|
NodeTag type;
|
1782
2165
|
RangeVar *relation; /* table to work on */
|
1783
2166
|
List *cmds; /* list of subcommands */
|
1784
|
-
ObjectType
|
2167
|
+
ObjectType objtype; /* type of object */
|
1785
2168
|
bool missing_ok; /* skip error if table missing */
|
1786
2169
|
} AlterTableStmt;
|
1787
2170
|
|
1788
2171
|
typedef enum AlterTableType
|
1789
2172
|
{
|
1790
2173
|
AT_AddColumn, /* add column */
|
1791
|
-
AT_AddColumnRecurse, /* internal to commands/tablecmds.c */
|
1792
2174
|
AT_AddColumnToView, /* implicitly via CREATE OR REPLACE VIEW */
|
1793
2175
|
AT_ColumnDefault, /* alter column default */
|
1794
2176
|
AT_CookedColumnDefault, /* add a pre-cooked column default */
|
@@ -1800,20 +2182,17 @@ typedef enum AlterTableType
|
|
1800
2182
|
AT_SetOptions, /* alter column set ( options ) */
|
1801
2183
|
AT_ResetOptions, /* alter column reset ( options ) */
|
1802
2184
|
AT_SetStorage, /* alter column set storage */
|
2185
|
+
AT_SetCompression, /* alter column set compression */
|
1803
2186
|
AT_DropColumn, /* drop column */
|
1804
|
-
AT_DropColumnRecurse, /* internal to commands/tablecmds.c */
|
1805
2187
|
AT_AddIndex, /* add index */
|
1806
2188
|
AT_ReAddIndex, /* internal to commands/tablecmds.c */
|
1807
2189
|
AT_AddConstraint, /* add constraint */
|
1808
|
-
AT_AddConstraintRecurse, /* internal to commands/tablecmds.c */
|
1809
2190
|
AT_ReAddConstraint, /* internal to commands/tablecmds.c */
|
1810
2191
|
AT_ReAddDomainConstraint, /* internal to commands/tablecmds.c */
|
1811
2192
|
AT_AlterConstraint, /* alter constraint */
|
1812
2193
|
AT_ValidateConstraint, /* validate constraint */
|
1813
|
-
AT_ValidateConstraintRecurse, /* internal to commands/tablecmds.c */
|
1814
2194
|
AT_AddIndexConstraint, /* add constraint using existing index */
|
1815
2195
|
AT_DropConstraint, /* drop constraint */
|
1816
|
-
AT_DropConstraintRecurse, /* internal to commands/tablecmds.c */
|
1817
2196
|
AT_ReAddComment, /* internal to commands/tablecmds.c */
|
1818
2197
|
AT_AlterColumnType, /* alter column type */
|
1819
2198
|
AT_AlterColumnGenericOptions, /* alter column OPTIONS (...) */
|
@@ -1823,6 +2202,7 @@ typedef enum AlterTableType
|
|
1823
2202
|
AT_SetLogged, /* SET LOGGED */
|
1824
2203
|
AT_SetUnLogged, /* SET UNLOGGED */
|
1825
2204
|
AT_DropOids, /* SET WITHOUT OIDS */
|
2205
|
+
AT_SetAccessMethod, /* SET ACCESS METHOD */
|
1826
2206
|
AT_SetTableSpace, /* SET TABLESPACE */
|
1827
2207
|
AT_SetRelOptions, /* SET (...) -- AM specific parameters */
|
1828
2208
|
AT_ResetRelOptions, /* RESET (...) -- AM specific parameters */
|
@@ -1851,9 +2231,11 @@ typedef enum AlterTableType
|
|
1851
2231
|
AT_GenericOptions, /* OPTIONS (...) */
|
1852
2232
|
AT_AttachPartition, /* ATTACH PARTITION */
|
1853
2233
|
AT_DetachPartition, /* DETACH PARTITION */
|
2234
|
+
AT_DetachPartitionFinalize, /* DETACH PARTITION FINALIZE */
|
1854
2235
|
AT_AddIdentity, /* ADD IDENTITY */
|
1855
2236
|
AT_SetIdentity, /* SET identity column options */
|
1856
|
-
AT_DropIdentity
|
2237
|
+
AT_DropIdentity, /* DROP IDENTITY */
|
2238
|
+
AT_ReAddStatistics /* internal to commands/tablecmds.c */
|
1857
2239
|
} AlterTableType;
|
1858
2240
|
|
1859
2241
|
typedef struct ReplicaIdentityStmt
|
@@ -1876,6 +2258,7 @@ typedef struct AlterTableCmd /* one subcommand of an ALTER TABLE */
|
|
1876
2258
|
* constraint, or parent table */
|
1877
2259
|
DropBehavior behavior; /* RESTRICT or CASCADE for DROP cases */
|
1878
2260
|
bool missing_ok; /* skip error if missing? */
|
2261
|
+
bool recurse; /* exec-time recursion */
|
1879
2262
|
} AlterTableCmd;
|
1880
2263
|
|
1881
2264
|
|
@@ -1934,27 +2317,39 @@ typedef struct GrantStmt
|
|
1934
2317
|
GrantTargetType targtype; /* type of the grant target */
|
1935
2318
|
ObjectType objtype; /* kind of object being operated on */
|
1936
2319
|
List *objects; /* list of RangeVar nodes, ObjectWithArgs
|
1937
|
-
* nodes, or plain names (as
|
2320
|
+
* nodes, or plain names (as String values) */
|
1938
2321
|
List *privileges; /* list of AccessPriv nodes */
|
1939
2322
|
/* privileges == NIL denotes ALL PRIVILEGES */
|
1940
2323
|
List *grantees; /* list of RoleSpec nodes */
|
1941
2324
|
bool grant_option; /* grant or revoke grant option */
|
2325
|
+
RoleSpec *grantor;
|
1942
2326
|
DropBehavior behavior; /* drop behavior (for REVOKE) */
|
1943
2327
|
} GrantStmt;
|
1944
2328
|
|
1945
2329
|
/*
|
1946
|
-
*
|
1947
|
-
*
|
1948
|
-
*
|
2330
|
+
* ObjectWithArgs represents a function/procedure/operator name plus parameter
|
2331
|
+
* identification.
|
2332
|
+
*
|
2333
|
+
* objargs includes only the types of the input parameters of the object.
|
2334
|
+
* In some contexts, that will be all we have, and it's enough to look up
|
2335
|
+
* objects according to the traditional Postgres rules (i.e., when only input
|
2336
|
+
* arguments matter).
|
2337
|
+
*
|
2338
|
+
* objfuncargs, if not NIL, carries the full specification of the parameter
|
2339
|
+
* list, including parameter mode annotations.
|
2340
|
+
*
|
2341
|
+
* Some grammar productions can set args_unspecified = true instead of
|
2342
|
+
* providing parameter info. In this case, lookup will succeed only if
|
2343
|
+
* the object name is unique. Note that otherwise, NIL parameter lists
|
2344
|
+
* mean zero arguments.
|
1949
2345
|
*/
|
1950
2346
|
typedef struct ObjectWithArgs
|
1951
2347
|
{
|
1952
2348
|
NodeTag type;
|
1953
2349
|
List *objname; /* qualified name of function/operator */
|
1954
|
-
List *objargs; /* list of Typename nodes */
|
1955
|
-
|
1956
|
-
|
1957
|
-
* means zero args) */
|
2350
|
+
List *objargs; /* list of Typename nodes (input args only) */
|
2351
|
+
List *objfuncargs; /* list of FunctionParameter nodes */
|
2352
|
+
bool args_unspecified; /* argument list was omitted? */
|
1958
2353
|
} ObjectWithArgs;
|
1959
2354
|
|
1960
2355
|
/*
|
@@ -1968,7 +2363,7 @@ typedef struct AccessPriv
|
|
1968
2363
|
{
|
1969
2364
|
NodeTag type;
|
1970
2365
|
char *priv_name; /* string name of privilege */
|
1971
|
-
List *cols; /* list of
|
2366
|
+
List *cols; /* list of String */
|
1972
2367
|
} AccessPriv;
|
1973
2368
|
|
1974
2369
|
/* ----------------------
|
@@ -1977,7 +2372,7 @@ typedef struct AccessPriv
|
|
1977
2372
|
* Note: because of the parsing ambiguity with the GRANT <privileges>
|
1978
2373
|
* statement, granted_roles is a list of AccessPriv; the execution code
|
1979
2374
|
* should complain if any column lists appear. grantee_roles is a list
|
1980
|
-
* of role names, as
|
2375
|
+
* of role names, as String values.
|
1981
2376
|
* ----------------------
|
1982
2377
|
*/
|
1983
2378
|
typedef struct GrantRoleStmt
|
@@ -1986,7 +2381,7 @@ typedef struct GrantRoleStmt
|
|
1986
2381
|
List *granted_roles; /* list of roles to be granted/revoked */
|
1987
2382
|
List *grantee_roles; /* list of member roles to add/delete */
|
1988
2383
|
bool is_grant; /* true = GRANT, false = REVOKE */
|
1989
|
-
|
2384
|
+
List *opt; /* options e.g. WITH GRANT OPTION */
|
1990
2385
|
RoleSpec *grantor; /* set grantor to other than current role */
|
1991
2386
|
DropBehavior behavior; /* drop behavior (for REVOKE) */
|
1992
2387
|
} GrantRoleStmt;
|
@@ -2032,7 +2427,7 @@ typedef struct CopyStmt
|
|
2032
2427
|
* preserve the distinction in VariableSetKind for CreateCommandTag().
|
2033
2428
|
* ----------------------
|
2034
2429
|
*/
|
2035
|
-
typedef enum
|
2430
|
+
typedef enum VariableSetKind
|
2036
2431
|
{
|
2037
2432
|
VAR_SET_VALUE, /* SET var = value */
|
2038
2433
|
VAR_SET_DEFAULT, /* SET var TO DEFAULT */
|
@@ -2078,7 +2473,7 @@ typedef struct CreateStmt
|
|
2078
2473
|
RangeVar *relation; /* relation to create */
|
2079
2474
|
List *tableElts; /* column definitions (list of ColumnDef) */
|
2080
2475
|
List *inhRelations; /* relations to inherit from (list of
|
2081
|
-
*
|
2476
|
+
* RangeVar) */
|
2082
2477
|
PartitionBoundSpec *partbound; /* FOR VALUES clause */
|
2083
2478
|
PartitionSpec *partspec; /* PARTITION BY clause */
|
2084
2479
|
TypeName *ofTypename; /* OF typename */
|
@@ -2154,6 +2549,8 @@ typedef enum ConstrType /* types of constraints */
|
|
2154
2549
|
|
2155
2550
|
typedef struct Constraint
|
2156
2551
|
{
|
2552
|
+
pg_node_attr(custom_read_write)
|
2553
|
+
|
2157
2554
|
NodeTag type;
|
2158
2555
|
ConstrType contype; /* see above */
|
2159
2556
|
|
@@ -2170,6 +2567,7 @@ typedef struct Constraint
|
|
2170
2567
|
char generated_when; /* ALWAYS or BY DEFAULT */
|
2171
2568
|
|
2172
2569
|
/* Fields used for unique constraints (UNIQUE and PRIMARY KEY): */
|
2570
|
+
bool nulls_not_distinct; /* null treatment for UNIQUE constraints */
|
2173
2571
|
List *keys; /* String nodes naming referenced key
|
2174
2572
|
* column(s) */
|
2175
2573
|
List *including; /* String nodes naming referenced nonkey
|
@@ -2195,6 +2593,7 @@ typedef struct Constraint
|
|
2195
2593
|
char fk_matchtype; /* FULL, PARTIAL, SIMPLE */
|
2196
2594
|
char fk_upd_action; /* ON UPDATE action */
|
2197
2595
|
char fk_del_action; /* ON DELETE action */
|
2596
|
+
List *fk_del_set_cols; /* ON DELETE SET NULL/DEFAULT (col1, col2) */
|
2198
2597
|
List *old_conpfeqop; /* pg_constraint.conpfeqop of my former self */
|
2199
2598
|
Oid old_pktable_oid; /* pg_constraint.confrelid of my former
|
2200
2599
|
* self */
|
@@ -2433,10 +2832,12 @@ typedef struct CreateAmStmt
|
|
2433
2832
|
typedef struct CreateTrigStmt
|
2434
2833
|
{
|
2435
2834
|
NodeTag type;
|
2835
|
+
bool replace; /* replace trigger if already exists */
|
2836
|
+
bool isconstraint; /* This is a constraint trigger */
|
2436
2837
|
char *trigname; /* TRIGGER's name */
|
2437
2838
|
RangeVar *relation; /* relation trigger is on */
|
2438
2839
|
List *funcname; /* qual. name of function to call */
|
2439
|
-
List *args; /* list of
|
2840
|
+
List *args; /* list of String or NIL */
|
2440
2841
|
bool row; /* ROW/STATEMENT */
|
2441
2842
|
/* timing uses the TRIGGER_TYPE bits defined in catalog/pg_trigger.h */
|
2442
2843
|
int16 timing; /* BEFORE, AFTER, or INSTEAD */
|
@@ -2444,7 +2845,6 @@ typedef struct CreateTrigStmt
|
|
2444
2845
|
int16 events; /* "OR" of INSERT/UPDATE/DELETE/TRUNCATE */
|
2445
2846
|
List *columns; /* column names, or NIL for all columns */
|
2446
2847
|
Node *whenClause; /* qual expression, or NULL if none */
|
2447
|
-
bool isconstraint; /* This is a constraint trigger */
|
2448
2848
|
/* explicitly named transition data */
|
2449
2849
|
List *transitionRels; /* TriggerTransition nodes, or NIL if none */
|
2450
2850
|
/* The remaining fields are only used for constraint triggers */
|
@@ -2573,7 +2973,7 @@ typedef struct DefineStmt
|
|
2573
2973
|
NodeTag type;
|
2574
2974
|
ObjectType kind; /* aggregate, operator, type */
|
2575
2975
|
bool oldstyle; /* hack to signal old CREATE AGG syntax */
|
2576
|
-
List *defnames; /* qualified name (list of
|
2976
|
+
List *defnames; /* qualified name (list of String) */
|
2577
2977
|
List *args; /* a list of TypeName (if needed) */
|
2578
2978
|
List *definition; /* a list of DefElem */
|
2579
2979
|
bool if_not_exists; /* just do nothing if it already exists? */
|
@@ -2587,7 +2987,7 @@ typedef struct DefineStmt
|
|
2587
2987
|
typedef struct CreateDomainStmt
|
2588
2988
|
{
|
2589
2989
|
NodeTag type;
|
2590
|
-
List *domainname; /* qualified name (list of
|
2990
|
+
List *domainname; /* qualified name (list of String) */
|
2591
2991
|
TypeName *typeName; /* the base type */
|
2592
2992
|
CollateClause *collClause; /* untransformed COLLATE spec, if any */
|
2593
2993
|
List *constraints; /* constraints (list of Constraint nodes) */
|
@@ -2600,7 +3000,7 @@ typedef struct CreateDomainStmt
|
|
2600
3000
|
typedef struct CreateOpClassStmt
|
2601
3001
|
{
|
2602
3002
|
NodeTag type;
|
2603
|
-
List *opclassname; /* qualified name (list of
|
3003
|
+
List *opclassname; /* qualified name (list of String) */
|
2604
3004
|
List *opfamilyname; /* qualified name (ditto); NIL if omitted */
|
2605
3005
|
char *amname; /* name of index AM opclass is for */
|
2606
3006
|
TypeName *datatype; /* datatype of indexed column */
|
@@ -2632,7 +3032,7 @@ typedef struct CreateOpClassItem
|
|
2632
3032
|
typedef struct CreateOpFamilyStmt
|
2633
3033
|
{
|
2634
3034
|
NodeTag type;
|
2635
|
-
List *opfamilyname; /* qualified name (list of
|
3035
|
+
List *opfamilyname; /* qualified name (list of String) */
|
2636
3036
|
char *amname; /* name of index AM opfamily is for */
|
2637
3037
|
} CreateOpFamilyStmt;
|
2638
3038
|
|
@@ -2643,7 +3043,7 @@ typedef struct CreateOpFamilyStmt
|
|
2643
3043
|
typedef struct AlterOpFamilyStmt
|
2644
3044
|
{
|
2645
3045
|
NodeTag type;
|
2646
|
-
List *opfamilyname; /* qualified name (list of
|
3046
|
+
List *opfamilyname; /* qualified name (list of String) */
|
2647
3047
|
char *amname; /* name of index AM opfamily is for */
|
2648
3048
|
bool isDrop; /* ADD or DROP the items? */
|
2649
3049
|
List *items; /* List of CreateOpClassItem nodes */
|
@@ -2713,12 +3113,13 @@ typedef struct SecLabelStmt
|
|
2713
3113
|
#define CURSOR_OPT_SCROLL 0x0002 /* SCROLL explicitly given */
|
2714
3114
|
#define CURSOR_OPT_NO_SCROLL 0x0004 /* NO SCROLL explicitly given */
|
2715
3115
|
#define CURSOR_OPT_INSENSITIVE 0x0008 /* INSENSITIVE */
|
2716
|
-
#define
|
3116
|
+
#define CURSOR_OPT_ASENSITIVE 0x0010 /* ASENSITIVE */
|
3117
|
+
#define CURSOR_OPT_HOLD 0x0020 /* WITH HOLD */
|
2717
3118
|
/* these planner-control flags do not correspond to any SQL grammar: */
|
2718
|
-
#define CURSOR_OPT_FAST_PLAN
|
2719
|
-
#define CURSOR_OPT_GENERIC_PLAN
|
2720
|
-
#define CURSOR_OPT_CUSTOM_PLAN
|
2721
|
-
#define CURSOR_OPT_PARALLEL_OK
|
3119
|
+
#define CURSOR_OPT_FAST_PLAN 0x0100 /* prefer fast-start plan */
|
3120
|
+
#define CURSOR_OPT_GENERIC_PLAN 0x0200 /* force use of generic plan */
|
3121
|
+
#define CURSOR_OPT_CUSTOM_PLAN 0x0400 /* force use of custom plan */
|
3122
|
+
#define CURSOR_OPT_PARALLEL_OK 0x0800 /* parallel mode OK */
|
2722
3123
|
|
2723
3124
|
typedef struct DeclareCursorStmt
|
2724
3125
|
{
|
@@ -2790,11 +3191,12 @@ typedef struct IndexStmt
|
|
2790
3191
|
List *excludeOpNames; /* exclusion operator names, or NIL if none */
|
2791
3192
|
char *idxcomment; /* comment to apply to index, or NULL */
|
2792
3193
|
Oid indexOid; /* OID of an existing index, if any */
|
2793
|
-
|
2794
|
-
SubTransactionId oldCreateSubid; /* rd_createSubid of
|
2795
|
-
SubTransactionId
|
2796
|
-
|
3194
|
+
RelFileNumber oldNumber; /* relfilenumber of existing storage, if any */
|
3195
|
+
SubTransactionId oldCreateSubid; /* rd_createSubid of oldNumber */
|
3196
|
+
SubTransactionId oldFirstRelfilelocatorSubid; /* rd_firstRelfilelocatorSubid
|
3197
|
+
* of oldNumber */
|
2797
3198
|
bool unique; /* is index unique? */
|
3199
|
+
bool nulls_not_distinct; /* null treatment for UNIQUE constraints */
|
2798
3200
|
bool primary; /* is index a primary key? */
|
2799
3201
|
bool isconstraint; /* is it for a pkey/unique constraint? */
|
2800
3202
|
bool deferrable; /* is the constraint DEFERRABLE? */
|
@@ -2813,14 +3215,30 @@ typedef struct IndexStmt
|
|
2813
3215
|
typedef struct CreateStatsStmt
|
2814
3216
|
{
|
2815
3217
|
NodeTag type;
|
2816
|
-
List *defnames; /* qualified name (list of
|
2817
|
-
List *stat_types; /* stat types (list of
|
3218
|
+
List *defnames; /* qualified name (list of String) */
|
3219
|
+
List *stat_types; /* stat types (list of String) */
|
2818
3220
|
List *exprs; /* expressions to build statistics on */
|
2819
3221
|
List *relations; /* rels to build stats on (list of RangeVar) */
|
2820
3222
|
char *stxcomment; /* comment to apply to stats, or NULL */
|
3223
|
+
bool transformed; /* true when transformStatsStmt is finished */
|
2821
3224
|
bool if_not_exists; /* do nothing if stats name already exists */
|
2822
3225
|
} CreateStatsStmt;
|
2823
3226
|
|
3227
|
+
/*
|
3228
|
+
* StatsElem - statistics parameters (used in CREATE STATISTICS)
|
3229
|
+
*
|
3230
|
+
* For a plain attribute, 'name' is the name of the referenced table column
|
3231
|
+
* and 'expr' is NULL. For an expression, 'name' is NULL and 'expr' is the
|
3232
|
+
* expression tree.
|
3233
|
+
*/
|
3234
|
+
typedef struct StatsElem
|
3235
|
+
{
|
3236
|
+
NodeTag type;
|
3237
|
+
char *name; /* name of attribute to index, or NULL */
|
3238
|
+
Node *expr; /* expression to index, or NULL */
|
3239
|
+
} StatsElem;
|
3240
|
+
|
3241
|
+
|
2824
3242
|
/* ----------------------
|
2825
3243
|
* Alter Statistics Statement
|
2826
3244
|
* ----------------------
|
@@ -2828,7 +3246,7 @@ typedef struct CreateStatsStmt
|
|
2828
3246
|
typedef struct AlterStatsStmt
|
2829
3247
|
{
|
2830
3248
|
NodeTag type;
|
2831
|
-
List *defnames; /* qualified name (list of
|
3249
|
+
List *defnames; /* qualified name (list of String) */
|
2832
3250
|
int stxstattarget; /* statistics target */
|
2833
3251
|
bool missing_ok; /* skip error if statistics object is missing */
|
2834
3252
|
} AlterStatsStmt;
|
@@ -2846,6 +3264,7 @@ typedef struct CreateFunctionStmt
|
|
2846
3264
|
List *parameters; /* a list of FunctionParameter */
|
2847
3265
|
TypeName *returnType; /* the return type */
|
2848
3266
|
List *options; /* a list of DefElem */
|
3267
|
+
Node *sql_body;
|
2849
3268
|
} CreateFunctionStmt;
|
2850
3269
|
|
2851
3270
|
typedef enum FunctionParameterMode
|
@@ -2855,7 +3274,9 @@ typedef enum FunctionParameterMode
|
|
2855
3274
|
FUNC_PARAM_OUT = 'o', /* output only */
|
2856
3275
|
FUNC_PARAM_INOUT = 'b', /* both */
|
2857
3276
|
FUNC_PARAM_VARIADIC = 'v', /* variadic (always input) */
|
2858
|
-
FUNC_PARAM_TABLE = 't' /* table function output column */
|
3277
|
+
FUNC_PARAM_TABLE = 't', /* table function output column */
|
3278
|
+
/* this is not used in pg_proc: */
|
3279
|
+
FUNC_PARAM_DEFAULT = 'd' /* default; effectively same as IN */
|
2859
3280
|
} FunctionParameterMode;
|
2860
3281
|
|
2861
3282
|
typedef struct FunctionParameter
|
@@ -2889,6 +3310,8 @@ typedef struct DoStmt
|
|
2889
3310
|
|
2890
3311
|
typedef struct InlineCodeBlock
|
2891
3312
|
{
|
3313
|
+
pg_node_attr(nodetag_only) /* this is not a member of parse trees */
|
3314
|
+
|
2892
3315
|
NodeTag type;
|
2893
3316
|
char *source_text; /* source text of anonymous code block */
|
2894
3317
|
Oid langOid; /* OID of selected language */
|
@@ -2898,17 +3321,29 @@ typedef struct InlineCodeBlock
|
|
2898
3321
|
|
2899
3322
|
/* ----------------------
|
2900
3323
|
* CALL statement
|
3324
|
+
*
|
3325
|
+
* OUT-mode arguments are removed from the transformed funcexpr. The outargs
|
3326
|
+
* list contains copies of the expressions for all output arguments, in the
|
3327
|
+
* order of the procedure's declared arguments. (outargs is never evaluated,
|
3328
|
+
* but is useful to the caller as a reference for what to assign to.)
|
3329
|
+
* The transformed call state is not relevant in the query jumbling, only the
|
3330
|
+
* function call is.
|
2901
3331
|
* ----------------------
|
2902
3332
|
*/
|
2903
3333
|
typedef struct CallStmt
|
2904
3334
|
{
|
2905
3335
|
NodeTag type;
|
2906
3336
|
FuncCall *funccall; /* from the parser */
|
2907
|
-
|
3337
|
+
/* transformed call, with only input args */
|
3338
|
+
FuncExpr *funcexpr pg_node_attr(query_jumble_ignore);
|
3339
|
+
/* transformed output-argument expressions */
|
3340
|
+
List *outargs pg_node_attr(query_jumble_ignore);
|
2908
3341
|
} CallStmt;
|
2909
3342
|
|
2910
3343
|
typedef struct CallContext
|
2911
3344
|
{
|
3345
|
+
pg_node_attr(nodetag_only) /* this is not a member of parse trees */
|
3346
|
+
|
2912
3347
|
NodeTag type;
|
2913
3348
|
bool atomic;
|
2914
3349
|
} CallContext;
|
@@ -2941,7 +3376,7 @@ typedef struct AlterObjectDependsStmt
|
|
2941
3376
|
ObjectType objectType; /* OBJECT_FUNCTION, OBJECT_TRIGGER, etc */
|
2942
3377
|
RangeVar *relation; /* in case a table is involved */
|
2943
3378
|
Node *object; /* name of the object */
|
2944
|
-
|
3379
|
+
String *extname; /* extension name */
|
2945
3380
|
bool remove; /* set true to remove dep rather than add */
|
2946
3381
|
} AlterObjectDependsStmt;
|
2947
3382
|
|
@@ -3087,8 +3522,8 @@ typedef struct CompositeTypeStmt
|
|
3087
3522
|
typedef struct CreateEnumStmt
|
3088
3523
|
{
|
3089
3524
|
NodeTag type;
|
3090
|
-
List *typeName; /* qualified name (list of
|
3091
|
-
List *vals; /* enum values (list of
|
3525
|
+
List *typeName; /* qualified name (list of String) */
|
3526
|
+
List *vals; /* enum values (list of String) */
|
3092
3527
|
} CreateEnumStmt;
|
3093
3528
|
|
3094
3529
|
/* ----------------------
|
@@ -3098,7 +3533,7 @@ typedef struct CreateEnumStmt
|
|
3098
3533
|
typedef struct CreateRangeStmt
|
3099
3534
|
{
|
3100
3535
|
NodeTag type;
|
3101
|
-
List *typeName; /* qualified name (list of
|
3536
|
+
List *typeName; /* qualified name (list of String) */
|
3102
3537
|
List *params; /* range parameters (list of DefElem) */
|
3103
3538
|
} CreateRangeStmt;
|
3104
3539
|
|
@@ -3109,7 +3544,7 @@ typedef struct CreateRangeStmt
|
|
3109
3544
|
typedef struct AlterEnumStmt
|
3110
3545
|
{
|
3111
3546
|
NodeTag type;
|
3112
|
-
List *typeName; /* qualified name (list of
|
3547
|
+
List *typeName; /* qualified name (list of String) */
|
3113
3548
|
char *oldVal; /* old enum value's name, if renaming */
|
3114
3549
|
char *newVal; /* new enum value's name */
|
3115
3550
|
char *newValNeighbor; /* neighboring enum value, if specified */
|
@@ -3171,6 +3606,12 @@ typedef struct AlterDatabaseStmt
|
|
3171
3606
|
List *options; /* List of DefElem nodes */
|
3172
3607
|
} AlterDatabaseStmt;
|
3173
3608
|
|
3609
|
+
typedef struct AlterDatabaseRefreshCollStmt
|
3610
|
+
{
|
3611
|
+
NodeTag type;
|
3612
|
+
char *dbname;
|
3613
|
+
} AlterDatabaseRefreshCollStmt;
|
3614
|
+
|
3174
3615
|
typedef struct AlterDatabaseSetStmt
|
3175
3616
|
{
|
3176
3617
|
NodeTag type;
|
@@ -3204,18 +3645,12 @@ typedef struct AlterSystemStmt
|
|
3204
3645
|
* Cluster Statement (support pbrown's cluster index implementation)
|
3205
3646
|
* ----------------------
|
3206
3647
|
*/
|
3207
|
-
typedef enum ClusterOption
|
3208
|
-
{
|
3209
|
-
CLUOPT_RECHECK = 1 << 0, /* recheck relation state */
|
3210
|
-
CLUOPT_VERBOSE = 1 << 1 /* print progress info */
|
3211
|
-
} ClusterOption;
|
3212
|
-
|
3213
3648
|
typedef struct ClusterStmt
|
3214
3649
|
{
|
3215
3650
|
NodeTag type;
|
3216
3651
|
RangeVar *relation; /* relation being indexed, or NULL if all */
|
3217
3652
|
char *indexname; /* original index defined */
|
3218
|
-
|
3653
|
+
List *params; /* list of DefElem nodes */
|
3219
3654
|
} ClusterStmt;
|
3220
3655
|
|
3221
3656
|
/* ----------------------
|
@@ -3281,7 +3716,7 @@ typedef struct CreateTableAsStmt
|
|
3281
3716
|
NodeTag type;
|
3282
3717
|
Node *query; /* the query (see comments above) */
|
3283
3718
|
IntoClause *into; /* destination table */
|
3284
|
-
ObjectType
|
3719
|
+
ObjectType objtype; /* OBJECT_TABLE or OBJECT_MATVIEW */
|
3285
3720
|
bool is_select_into; /* it was written as SELECT INTO */
|
3286
3721
|
bool if_not_exists; /* just do nothing if it already exists? */
|
3287
3722
|
} CreateTableAsStmt;
|
@@ -3353,11 +3788,6 @@ typedef struct ConstraintsSetStmt
|
|
3353
3788
|
* REINDEX Statement
|
3354
3789
|
* ----------------------
|
3355
3790
|
*/
|
3356
|
-
|
3357
|
-
/* Reindex options */
|
3358
|
-
#define REINDEXOPT_VERBOSE (1 << 0) /* print progress info */
|
3359
|
-
#define REINDEXOPT_REPORT_PROGRESS (1 << 1) /* report pgstat progress */
|
3360
|
-
|
3361
3791
|
typedef enum ReindexObjectType
|
3362
3792
|
{
|
3363
3793
|
REINDEX_OBJECT_INDEX, /* index */
|
@@ -3374,8 +3804,7 @@ typedef struct ReindexStmt
|
|
3374
3804
|
* etc. */
|
3375
3805
|
RangeVar *relation; /* Table or index to reindex */
|
3376
3806
|
const char *name; /* name of database to reindex */
|
3377
|
-
|
3378
|
-
bool concurrent; /* reindex concurrently? */
|
3807
|
+
List *params; /* list of DefElem nodes */
|
3379
3808
|
} ReindexStmt;
|
3380
3809
|
|
3381
3810
|
/* ----------------------
|
@@ -3483,7 +3912,7 @@ typedef struct ReassignOwnedStmt
|
|
3483
3912
|
typedef struct AlterTSDictionaryStmt
|
3484
3913
|
{
|
3485
3914
|
NodeTag type;
|
3486
|
-
List *dictname; /* qualified name (list of
|
3915
|
+
List *dictname; /* qualified name (list of String) */
|
3487
3916
|
List *options; /* List of DefElem nodes */
|
3488
3917
|
} AlterTSDictionaryStmt;
|
3489
3918
|
|
@@ -3503,29 +3932,64 @@ typedef struct AlterTSConfigurationStmt
|
|
3503
3932
|
{
|
3504
3933
|
NodeTag type;
|
3505
3934
|
AlterTSConfigType kind; /* ALTER_TSCONFIG_ADD_MAPPING, etc */
|
3506
|
-
List *cfgname; /* qualified name (list of
|
3935
|
+
List *cfgname; /* qualified name (list of String) */
|
3507
3936
|
|
3508
3937
|
/*
|
3509
3938
|
* dicts will be non-NIL if ADD/ALTER MAPPING was specified. If dicts is
|
3510
3939
|
* NIL, but tokentype isn't, DROP MAPPING was specified.
|
3511
3940
|
*/
|
3512
|
-
List *tokentype; /* list of
|
3513
|
-
List *dicts; /* list of list of
|
3941
|
+
List *tokentype; /* list of String */
|
3942
|
+
List *dicts; /* list of list of String */
|
3514
3943
|
bool override; /* if true - remove old variant */
|
3515
3944
|
bool replace; /* if true - replace dictionary by another */
|
3516
3945
|
bool missing_ok; /* for DROP - skip error if missing? */
|
3517
3946
|
} AlterTSConfigurationStmt;
|
3518
3947
|
|
3948
|
+
typedef struct PublicationTable
|
3949
|
+
{
|
3950
|
+
NodeTag type;
|
3951
|
+
RangeVar *relation; /* relation to be published */
|
3952
|
+
Node *whereClause; /* qualifications */
|
3953
|
+
List *columns; /* List of columns in a publication table */
|
3954
|
+
} PublicationTable;
|
3955
|
+
|
3956
|
+
/*
|
3957
|
+
* Publication object type
|
3958
|
+
*/
|
3959
|
+
typedef enum PublicationObjSpecType
|
3960
|
+
{
|
3961
|
+
PUBLICATIONOBJ_TABLE, /* A table */
|
3962
|
+
PUBLICATIONOBJ_TABLES_IN_SCHEMA, /* All tables in schema */
|
3963
|
+
PUBLICATIONOBJ_TABLES_IN_CUR_SCHEMA, /* All tables in first element of
|
3964
|
+
* search_path */
|
3965
|
+
PUBLICATIONOBJ_CONTINUATION /* Continuation of previous type */
|
3966
|
+
} PublicationObjSpecType;
|
3967
|
+
|
3968
|
+
typedef struct PublicationObjSpec
|
3969
|
+
{
|
3970
|
+
NodeTag type;
|
3971
|
+
PublicationObjSpecType pubobjtype; /* type of this publication object */
|
3972
|
+
char *name;
|
3973
|
+
PublicationTable *pubtable;
|
3974
|
+
int location; /* token location, or -1 if unknown */
|
3975
|
+
} PublicationObjSpec;
|
3519
3976
|
|
3520
3977
|
typedef struct CreatePublicationStmt
|
3521
3978
|
{
|
3522
3979
|
NodeTag type;
|
3523
3980
|
char *pubname; /* Name of the publication */
|
3524
3981
|
List *options; /* List of DefElem nodes */
|
3525
|
-
List *
|
3982
|
+
List *pubobjects; /* Optional list of publication objects */
|
3526
3983
|
bool for_all_tables; /* Special publication for all tables in db */
|
3527
3984
|
} CreatePublicationStmt;
|
3528
3985
|
|
3986
|
+
typedef enum AlterPublicationAction
|
3987
|
+
{
|
3988
|
+
AP_AddObjects, /* add objects to publication */
|
3989
|
+
AP_DropObjects, /* remove objects from publication */
|
3990
|
+
AP_SetObjects /* set list of objects */
|
3991
|
+
} AlterPublicationAction;
|
3992
|
+
|
3529
3993
|
typedef struct AlterPublicationStmt
|
3530
3994
|
{
|
3531
3995
|
NodeTag type;
|
@@ -3534,10 +3998,14 @@ typedef struct AlterPublicationStmt
|
|
3534
3998
|
/* parameters used for ALTER PUBLICATION ... WITH */
|
3535
3999
|
List *options; /* List of DefElem nodes */
|
3536
4000
|
|
3537
|
-
/*
|
3538
|
-
|
4001
|
+
/*
|
4002
|
+
* Parameters used for ALTER PUBLICATION ... ADD/DROP/SET publication
|
4003
|
+
* objects.
|
4004
|
+
*/
|
4005
|
+
List *pubobjects; /* Optional list of publication objects */
|
3539
4006
|
bool for_all_tables; /* Special publication for all tables in db */
|
3540
|
-
|
4007
|
+
AlterPublicationAction action; /* What action to perform with the given
|
4008
|
+
* objects */
|
3541
4009
|
} AlterPublicationStmt;
|
3542
4010
|
|
3543
4011
|
typedef struct CreateSubscriptionStmt
|
@@ -3553,9 +4021,12 @@ typedef enum AlterSubscriptionType
|
|
3553
4021
|
{
|
3554
4022
|
ALTER_SUBSCRIPTION_OPTIONS,
|
3555
4023
|
ALTER_SUBSCRIPTION_CONNECTION,
|
3556
|
-
|
4024
|
+
ALTER_SUBSCRIPTION_SET_PUBLICATION,
|
4025
|
+
ALTER_SUBSCRIPTION_ADD_PUBLICATION,
|
4026
|
+
ALTER_SUBSCRIPTION_DROP_PUBLICATION,
|
3557
4027
|
ALTER_SUBSCRIPTION_REFRESH,
|
3558
|
-
ALTER_SUBSCRIPTION_ENABLED
|
4028
|
+
ALTER_SUBSCRIPTION_ENABLED,
|
4029
|
+
ALTER_SUBSCRIPTION_SKIP
|
3559
4030
|
} AlterSubscriptionType;
|
3560
4031
|
|
3561
4032
|
typedef struct AlterSubscriptionStmt
|